Can anybody explain this code why does this code produce 0,2.
Code
/*
class Sup{
int a = f();
public int f(){
return 1;
}
}
class Subclass extends Sup{
int b = 2;
public int f(){
return b;
}
}
class TestSub{
public static void main(String args[]){
Sup sup = new Subclass();
System.out.println(sup.a);
System.out.println(sup.f());
}
}
*/
[ EJFH: Add descriptive subject ]
[ July 16, 2007: Message edited by: Ernest Friedman-Hill ]