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

java static

 
Lucy Rai
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please to reply about static in java deeply
 
Campbell Ritchie
Sheriff
Pie
Posts: 48976
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Fields: do they belong to the class? Do you want one copy and one copy only? Do you want access before any objects are created?
Methods: please search for “Campbell Ritchie Classification of Methods”. Something ending in 68 can be static.

In most cases, it is a mistake to make anything static unless you know exactly why it ought to be static. In order to compile is a very bad reason to make something static.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic