File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Static 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 "Static Class" Watch "Static Class" New topic

Static Class

Tan Richards

Joined: Sep 29, 2005
Posts: 18
Can anyone plz tell me why top level static classes are not allowed in Java?

"Failures are pillars of success" - That doesn't mean you go on building pillars
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

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?

[Jess in Action][AskingGoodQuestions]
Aadi Narayana Reddy

Joined: Oct 17, 2005
Posts: 13
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.

G.Adi Narayana Reddy,
I agree. Here's the link:
subject: Static Class
jQuery in Action, 3rd edition