aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes why top level classess can not be static Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "why top level classess can not be static" Watch "why top level classess can not be static" New topic
Author

why top level classess can not be static

vikas karandikar
Greenhorn

Joined: Apr 11, 2002
Posts: 12
why top level classess can not be static.
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
you mean package member classes... because top-level (nested) classes are always static...
Static means that no instance of the enclosing class is needed to instantiate the enclosed class.
[ October 11, 2002: Message edited by: Valentin Crettaz ]

SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
vikas karandikar
Greenhorn

Joined: Apr 11, 2002
Posts: 12
You are perfectly write my question was of regarding package member class.
We know that ,if method or variable is static that means it can be accessed without any referance of class.Moreover static variable belong to whole class etc
But what are the possible reasons for a entire class to be non-static.
In short my question is
"Why java does not allow to declare top level menber class as static?"
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
It would be a good idea if you could read the following chapter of Mughal's book:
Chapter 7: Inner classes
The topic is very well explained there
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: why top level classess can not be static