File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why top most class cannot be static?

 
Scott Bravo
Greenhorn
Posts: 18
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why top most class cannot be static....
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is the use ? there is no point in declaring it static
 
Scott Bravo
Greenhorn
Posts: 18
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
seetharaman can you give more bright idea on this .
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 47229
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic