Instance variable
This article may need to be rewritten to comply with Wikipedia's quality standards. (February 2010) |
In object-oriented programming with classes, an instance variable is a variable defined in a class (i.e. a member variable), for which each object in the class has a separate copy.
An instance variable is the opposite of class variable, and it is a special type of instance member. An example of an instance variable is "private double length"
Instance Variables (Non-Static Fields) Technically speaking, are objects stored in individual states in "non-static fields", that is, fields declared without the static keyword. Non-static fields are also known as instance variables because their values are unique to each instance of a class (to each object, in other words); the currentSpeed of one bicycle is independent from the currentSpeed of another.