Hi
When u refer to a member variable of an Interface, it Initializes all of its
member variables.
Try this:
interface I{
int i = 1, ii = B.out("ii", 2);
}
interface J extends I{
int jj = B.out("jj", 4);
}
interface K extends J{
int k = B.out("k", 5),j = B.out("j", 3);
}
class B{
public static void main(
String[] args) {
System.out.println(K.j);
}
public static int out(String s, int i){
System.out.println(s + "=" + i);
return i;
}
}
And u will get:
k=5
j=3
3
Hope this helps