This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
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

Win a copy of REST with Spring (video course) this week in the Spring forum!
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: 24195

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
It's not a secret anymore!