What is instance variable?

Answer:
Instance variable

A variable, part of an Object. These might better be called perObject variables since each instantiated object of this class will have its own private copy of this variable. They are allocated when the object is allocated via new.

Static methods may not access the instance variables of their class (or any other class for that matter), other that via some object reference, e.g. anObject.someField. Static methods may even access private instance variables in their class via some object reference.

First answer by Anandvijayakumar. Last edit by Anandvijayakumar. Contributor trust: 783 [recommend contributor recommended]. Question popularity: 2 [recommend question].