wood burning stoves 2.0*
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

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 629

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?
It is sorta covered in the JavaRanch Style Guide.
subject: doubt Method local inner class
Similar Threads
Code for Method-Local Inner Classes not compiling
K&B page 466 "method-local inner class"
Doubts regarding Method local inner class
Final variable access from class inside function
My post lost..so once again ques from K&B(local class)