Meaningless Drivel is fun!
The moose likes Java in General and the fly likes Top level Class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Top level Class" Watch "Top level Class" New topic

Top level Class

Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Need what is meant by Top level class.
Example Static Inner Class ? How are they top level classes. Main Difference between Top level Class as a result of static modifier and Normal Top Level Class.
Amar Srivastava

Joined: Jul 25, 2000
Posts: 3
well Static inner classes are not top level classes, they are technically speaking called "top-level nested classes" which differentiates them from just plain top-level classes. Top level classes on the other hand are public/default classes that are held in .java files and are not enclosed in any other classes
[This message has been edited by Amar Srivastava (edited July 25, 2000).]
ricky gonzalez
Ranch Hand

Joined: Jun 30, 2000
Posts: 167
Top level classes are the independent, free classes that can be either public or default. Static inner classes are considered top level because they are really independent from the enclosing class and can be called at anytime separately from its outer classes.
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Top level classes can be defined as classes that are
1)static class members and
2)classes which are package members
Thus nested classes(static class members) are indeed Top Level classes.
for futher info on inner classes visit ml

[This message has been edited by rahul_mkar (edited July 26, 2000).]
I agree. Here's the link:
subject: Top level Class
It's not a secret anymore!