This week's book giveaway is in the JavaFX forum.
We're giving away four copies of Introducing JavaFX 8 Programming and have Herbert Schildt on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Inner Classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Inner Classes" Watch "Inner Classes" New topic
Author

Inner Classes

Adrian Yan
Ranch Hand

Joined: Oct 02, 2000
Posts: 688
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

Joined: Jun 30, 2000
Posts: 1070
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Inner Classes
 
It's not a secret anymore!