GeeCON Prague 2014*
The moose likes Java in General and the fly likes Inner Class Final vaiable reference Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "Inner Class Final vaiable reference" Watch "Inner Class Final vaiable reference" New topic
Author

Inner Class Final vaiable reference

Hs Raveendran
Greenhorn

Joined: Feb 05, 2010
Posts: 23




for the above code i am getting below saying

Cannot refer to a non-final variable x inside an inner class defined in a different method


Q: why inner class method is not able to refer non final variable
Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3647
    
  16

Take a look here:
http://www.coderanch.com/t/524522/java-programmer-SCJP/certification/Special-treatment-final-vaiables-method
 
GeeCON Prague 2014
 
subject: Inner Class Final vaiable reference