Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Static Class

 
Tan Richards
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Can anyone plz tell me why top level static classes are not allowed in Java?
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What would be the difference between a top-level static class and a top-level non-static class? Or in other words, what would you expect "static" to mean for a top-level class?
 
Aadi Narayana Reddy
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The top level class never be static. IT is language defined.
Class is intended to create objects to make useful. Static things not belong to any object. They have defined like that.

But static inner classes exists, means that that class object can be accessed with out having the object of the top level class.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic