<< November 13, 2008 | Home | November 15, 2008 >>

Friday Is Almost Over, But We Can Always Have A Late Quiz...

(Courtesy of crazybob.)

Bob Lee: Java: interface A extends B {} interface B extends A {} ⇒ javac says, "Error: cyclic inheritance." That's a good one for Weiqi.

6 minutes ago from twitterrific

Q: What happens when you compile the two files:

// A.java
public interface A extends B {
}

// B.java
public interface B extends A {
}

If the answer is obvious, try this: Change B.java into a marker interface then compile A.java. Put the class file aside. Do the same for B.java. Then bring both class files together.

Q: Will the following code compile against such A.class and B.class?

// C.java
public class C implements A, B {
}
Tags :