File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes why top most class cannot be static? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "why top most class cannot be static?" Watch "why top most class cannot be static?" New topic
Author

why top most class cannot be static?

Scott Bravo
Greenhorn

Joined: Jun 15, 2009
Posts: 18
why top most class cannot be static....
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

what is the use ? there is no point in declaring it static
Scott Bravo
Greenhorn

Joined: Jun 15, 2009
Posts: 18
seetharaman can you give more bright idea on this .
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

the class is already top-level , there is no need to create an package object to get the class, importing a package is enough.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40052
    
  28
Anything static "belongs" to a class, so it must be inside a class and outside a method. So how can a top-level class be inside a class?
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Technically it could belong to the JVM itself, or whatever class/object it uses to launch the program, similar to how some REPLs/languages handle "standalone" method declarations. Obviously that's not how Java works, but that would be my "solution" to what's ultimately a non-problem in any real sense.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: why top most class cannot be static?