File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Inner Classes" Watch "Inner Classes" New topic

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.
I agree. Here's the link:
subject: Inner Classes
It's not a secret anymore!