aspose file tools*
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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "about Object declaration as static" Watch "about Object declaration as static" New topic
Author

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 ]
 
 
subject: about Object declaration as static
 
Similar Threads
this!!
Doubt in Setting the session scope as Application
Single tone Vs Static
What is "non-static method" vs "static context" ?
Head First Java Chapter 15 problem