Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) 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
Marshal
Posts: 53135
124
  • 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.
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!