What is static in java
What is static in java
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
AartiPosted Nov 17, 2011, 1:58 AM
Satyapriya NayakPosted Nov 17, 2011, 2:14 AM
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