This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills: The software developer's life manual and have John Sonmez on-line!
See this thread for details.
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why access to non-final local variables is not permitted from local classes?

 
sura watthana
Ranch Hand
Posts: 77
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm wondering why access to non-final local variables is not permitted from local classes? Could somebody tell me the reason why? Thank you

 
David Ulicny
Ranch Hand
Posts: 724
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Read this article
http://www.javaranch.com/campfire/StoryInner.jsp
 
Saheed Adepoju
Ranch Hand
Posts: 267
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Remember that local variables are only available to the method! After the method returns there would be no reference to the variable any longer! But if it were made final the value of the local variable doesnt change even if the method returns1 hope u understand.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic