Static in Java - Variables, Methods, Class and Static blocks
Static is a keyword is applied to the following in Java.
1) Variable
2) Method
3) Class
4) Static blocks
Static Variables :
Static variables have special feature in Java as this initialized and executed only once before class instantiated. Static variables are comes under class level and no need to create the object to invoke static variables. Directly can be accessed by its class name. This is being shared by all objects created by its class.
Refer below Example program covered all scenarios for Static Variable: