"Since the names of local classes are not visible outside the local context, references of these classes cannot be declared outside. So their functionality could be accessed only via super-class references (either interfaces or classes). Objects of those class types are created inside methods and returned as super-class type references to the outside world. This is the reason that they can only access final variables within the local block. That way, the value of the variable can be always made available to the objects returned from the local context to outside world."
can somebodt explain the above context with a example -plzzzz thanks in advance ------------------ "Winners don't do different things They do things differently"
"Winners don't do different things<br /> They do things differently"
it means that we cant create a reference of the local inner class outside and we have to create an object of the same and return it. consider the case when we r referencing to a non-final local variable inside our local inner class.the local variables r destroyed once the control comes out of the function but the object which is returned by the function still refers to it and this will cause a problem . now if that vasriable is final then java compiler will create a new instance variable for the local inner class and pass it when the object is initialized . this is done by the compiler not the runtime environment. this is bcos the compiler is sure the variable wont change afterwards . this i think will create u r doubt but i ve got a doubt about this i hope someone will answer this i read that i can have a blank final vasriable inside a local inner class what if i dont initialize this varable before i create an instance of the local inner class or is there that restriction