| Author |
method local inner class
|
Shiva Mohan
Ranch Hand
Joined: Jan 05, 2006
Posts: 465
|
|
i thought final varaibles of enclosing class only accessible in method local inner class like method local variable(y1) but i1 and i are accessing inside inner class.Why?
|
 |
marc weber
Sheriff
Joined: Aug 31, 2004
Posts: 11343
|
|
It's only the non-final local (method) variables that the local class cannot use. The reason is that local (method) variables are destroyed when the method exits. If these are final, then their values can be copied into any instances of the local class. But the local class can use non-final variables outside the method (that is, members of the enclosing class).
|
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
|
 |
 |
|
|
subject: method local inner class
|
|
|