• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Inner Class Final vaiable reference

 
Raveendran Hs
Greenhorn
Posts: 23
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



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
Pie
Posts: 6128
74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look here:
http://www.coderanch.com/t/524522/java-programmer-SCJP/certification/Special-treatment-final-vaiables-method
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic