What is static in java
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
AartiRank #2,383 · 594 reputationPosted Nov 16, 2011, 8:58 PM EST
Satyapriya NayakRank #47 · 31.5K reputationPosted Nov 16, 2011, 9:14 PM EST
Class methods are methods which are declared as static. The method can be called without creating an instance of the class.
A static variable is associated with the class as a whole rather than with specific instances of a class.
Methods declared with the keyword static as modifier are called static methods or class methods. They are so called because they affect a class as a whole, not a particular instance of the class. Static methods are always invoked without reference to a particular instance of a class.
Note:The use of a static method suffers from the following restrictions:
· A static method can only call other static methods.
· A static method must only access static data.
· A static method cannot reference to the current object using keywords super or this.
Thanks