Back to Top

Sunday 15 January 2012

JAVA : What is static in java?

  Static means one per class, not one for each object no matter how many instance of a class might exist. This means that you can use them without creating an instance of a class.Static methods are implicitly final, because overriding is done based on the type of the object, and static methods are attached to a class, not an object. A static method in a superclass can be shadowed by another static method in a subclass, as long as the original method was not declared final. However, you can't override a static method with a nonstatic method. In other words, you can't change a static method into an instance method in a subclass.

5 Responses to “ JAVA : What is static in java? ”

Anonymous said...
9 May 2012 at 13:12

great


Anonymous said...
18 August 2013 at 12:27

When any member of a class is declared as static then it can be accessed without creating any object of the class.
If a variable is declared as static then even if several objects of the class are created but no copy of the variable is made;all the instances share the same static variable.
If a method is declared as static then that method can access only static data,it can invoke only static methods and it can't use "this" and "super" keyword.
So normally a class member is accessed with the help of an object of a class.But by using static it is possible to access them without creating an object.


Anonymous said...
25 May 2017 at 16:05

this is very useful for every one who want to learn about static keyword with easy steps and in detail also.
thank you


Praveen H said...
28 October 2018 at 22:19

nice article thank you.
For java interview programs visit: Java programming


Prashant said...
13 January 2020 at 18:07

Thanks for sharing such a useful information. Keep sharing.
Advanced Java training


Post a Comment

Popular Posts

Subscribe via Email
Subscribe Java Interview Questions via Email
All Rights Reserved JAVA INTERVIEW QUESTIONS | Privacy Policy | Anijit Sarkar