Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

about Object declaration as static

 
Anand Natraj
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can we declare an object of class as Static.If it can be declared static what is it's use
 
Rachel Swailes
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You will see that you cannot declare a static class.
 
Jeffrey Hunter
Ranch Hand
Posts: 305
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic