Static
Static belong to class NOT to the instance (object)
Static Variable: gets memory only once in the class area at the Time of Loading
Static Methods : Invoked without creating instance (eg. Math.pow()
)
- useful for memory management
- Static can be blocks, variables, methods & nested class (inner class)
can access static data member
Inheritance : Static methods of only parent is visible
Static method Restrictions
- Cannot use non static data field or method directly
- Cannot use this and super on the static context