File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes doubt Method local inner class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "doubt Method local inner class" Watch "doubt Method local inner class" New topic

doubt Method local inner class

Shashank Sharma
Ranch Hand

Joined: Sep 27, 2006
Posts: 91

according to the book a method local inner class object cannot use local variable of the method unless they are marked final.
but in the code above I can access the local variable from both the places 1&2.
Pramod P Deore
Ranch Hand

Joined: Jul 15, 2008
Posts: 632

local variable means variable declared inside method in which your local inner class is defined.

Life is easy because we write the source code.....
Harpreet Singh janda
Ranch Hand

Joined: Jan 14, 2010
Posts: 317

Local means the variables which belongs to outer class and are local to that particular method.
Think : - If you are not allowed to access the local members of your own local class then what is the use of variables in that context?
I agree. Here's the link:
subject: doubt Method local inner class
It's not a secret anymore!