Hi all,
can someone please explain me the rules or the order for initialising interfaces.
for example, a question from Dan's collection:
interface C {
char w = DD.echo('w');
char x = DD.echo('x');
}
interface D extends C {
char y = DD.echo('y');
char z = DD.echo('z');
char a = DD.echo(w);
}
class DD implements D {
static char echo(char c) {
System.out.print(c);
return c;
}
public static void main (
String[] args) {
System.out.print("Main");
DD dd = new DD();
System.out.println(a);
}
}
answer is Mainyzwxww.
no problem with the main first but why is it yzwxww, are the interface's variables get initialised only if required? don't quite get this one...
anyone?
Thanks (again !
)
Shimi