hi all,
i tried to execute a program with static inner classes and tried to access the enclosing instance's static variable.
it compiles fine. but gives
"Exception in
Thread "main" java.lang.VerifyError (class: myclass method: main signature: (LJava/lang/String
V) Expecting to find uninitialized object on stack.
here is the code which created the above error at runtime.
class myouter{
int i ;
static int j;
myouter(){
System.out.println("Inside myouter()");
i =2;
j=3;
System.out.println("i is : "+i);
System.out.println("j is : "+j);
}
static class myinner{
myinner(){
System.out.println("Inside myinner()");
System.out.println("j is : "+j);
}//end of myinner()
}//end of myinner...
}
public class myclass{
public static void main(
String args[]){
myouter.myinner in = new myouter().new myinner();
}//end of main
}
can anyone explain what is wrong with my code please? what am i missing ??
Thanks,
Sunitha. S