posted 17 years ago
Hi,
I have confusion that if declare a variable or object refernce as final then where they reside. As I was going through Inner classes topic and its like if declare variable as final Inner clas is able to access but not normal variable.
Compiling the preceding code really upsets the compiler:
MyOuter2.java:8: local variable z is accessed from within inner class;
needs to be declared final
System.out.println("Local variable z is " + z);
^
Can any one exaplein why it is so?
Thanks in advance
SCJP1.5(81%), SCDJWS(94%), next mission SCEA (but need to wait or that)