about 1 year ago
Hello. I'm trying to solve the following problem.
I have 4 interfaces that are in a diamond shape and 2 classes.
The requirements is to make the method calls work, while keeping f1 as the interface of x.
Can you guys give me a hand?
package lab4;
public class Prob6 {
public static void main(String[] args) { f1 x = new object(); x.method1(); x.method2(); x.method3(); x.method4(); }
}
interface f1{ void method1(); }
interface f2 extends f1{ void method2(); }
interface f3 extends f1{ void method3(); }
interface f4 extends f2,f3{ void method4(); }
class object implements f4{ public void method1() { System.out.println("method 1"); } public void method2() { System.out.println("method 2"); } public void method3() { System.out.println("method 3"); } public void method4() { System.out.println("method 4"); } }
Starting with Chrome version 45, NPAPI is no longer supported for Google Chrome. For more information, see Chrome and NPAPI (blog.chromium.org).
Firefox and Microsoft Internet Explorer are recommended browsers for websites using java applets.
Chrome Version Support
Are you sure, you want to delete this comment?
Sign up using
0 Answer(s)