File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes about Object declaration as static Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "about Object declaration as static" Watch "about Object declaration as static" New topic

about Object declaration as static

Anand Natraj
Ranch Hand

Joined: May 17, 2004
Posts: 53
Can we declare an object of class as Static.If it can be declared static what is it's use
Rachel Swailes
Ranch Hand

Joined: May 18, 2004
Posts: 434
You will see that you cannot declare a static class.
Jeffrey Hunter
Ranch Hand

Joined: Apr 16, 2004
Posts: 305

The method readMe() belongs to the class, and not any particular instance of the class.

Realize, you can have nested member classes (classes declared in body of top-level class), which may be static. But this follows the same idea that, when dealing with classes, only members of the class can be declared static.

You can get a better grip on this idea by reading a definition of the static modifier here.
[ June 07, 2004: Message edited by: Jeffrey Hunter ]
I agree. Here's the link:
subject: about Object declaration as static
It's not a secret anymore!