Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Inner Classes  RSS feed

 
Adrian Yan
Ranch Hand
Posts: 688
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are the variables can the non-static inner classes access? Are they the static variables, final instance variables?
What about anonymous class?
 
bill bozeman
Ranch Hand
Posts: 1070
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Non-static inner classes, not defined inside methods, can access all variables of the top-level class.
Non-static inner classes, defined inside methods, can access all variables fo the top-level class, and all final variables of the enclosing method.
Bill
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!