static methods' behaviors that are not affected by the state of any instances.
static variables hold data that is class specific as opposed to instance specific.
All static members belong to the class, not to any instance.
A static method can't access an instance variable directly.
Use the dot operator to access static members:
static methods can't be overridden, but they can be redefined.
Things you can mark as static:
methods
Variables
A class nested within another class, but not within a method.
Initialization blocks
Things you can't mark as static:
Constructors
Classes unless they are nested
Interfaces
Method local inner classes
Inner class methods and instance variables
Local variables
|