Java   View all facts   Glossary   Help
member > instance member > instance variable
Next instance memberinstance method    Upinstance member, member variable

instance variable
(data member, field, object variable)
subjectfact 
instance variableis a synonym of data member2001-10-19 11:36:35.0
is a synonym of field2001-10-19 11:36:42.0
can be inheritedadded by: JK, source: Sun Java Tutorial, 2001-10-19 11:36:56.0
can be accessed by all methods of its classadded by: DS, 2001-10-19 11:36:56.0
can be made private to prevent direct access to instance variable - accessor methods should be used instead to protect data abstractionadded by: JK, source: On To Java, 2001-10-19 11:36:56.0
has definition A data item present in all the instances of a class, normally used to implement associations and attributessource: Object Oriented Software Engineering by Lethbridge and Laganière, 2001-10-19 11:36:56.0
has definition Any item of data that is associated with a particular object.added by: JK, source: Sun Java Tutorial, reference: Glossary, 2001-10-19 11:36:56.0
implements an attribute or an association    source: Object Oriented Software Engineering by Lethbridge and Laganière, 2001-10-19 11:36:56.0
is part of an objectadded by: JK, 2001-10-19 11:36:57.0
is a subtopic of Members2001-10-19 11:36:57.0
is defined by an instance variable definitionadded by: JK, 2001-10-19 11:36:57.0
is a kind of instance memberadded by: JK, 2001-10-19 11:36:57.0
is a kind of member variableadded by: JK, 2001-10-19 11:36:57.0
maintains part of its object's stateadded by: JK, source: Sun Java Tutorial, 2001-10-19 11:36:57.0
refers to an object or a primitiveadded by: DS, 2001-10-19 11:36:57.0
should be as private as reasonably possible - almost never make an instance variable public    source: Object Oriented Software Engineering by Lethbridge and Laganière, 2001-10-19 11:36:57.0
should be placed in a class such that there is no needless duplication of it, and such that it is useful in all the subclasses of the class in which it is definedadded by: JK, source: On To Java, 2001-10-19 11:36:57.0
to refer you join the name of the variable with a dot to the instance variable name.
Example:
variableName.instanceVariableName
added by: JK, source: On To Java, 2001-10-19 11:36:57.0
is a synonym of object variable2001-10-19 11:37:34.0
member variablecan be declared anywhere in a class outside of a method2001-10-19 11:37:20.0
can be initialized by an assignment statement2001-10-19 11:37:20.0
is a member of a class or an object2001-10-19 11:37:20.0
is accessible to the code in its class2001-10-19 11:37:20.0
variablecan contain different classes of objects depending on the type of the variable2001-10-19 11:38:12.0
can contain only values that are of the same type as the variable or a subtype of the variable's type2001-10-19 11:38:12.0
can have an interface as its type which means that, with the variable, you can invoke any operation supported by the interface    2001-10-19 11:38:12.0
has 1 value at any one time which is the that it refers to2001-10-19 11:38:13.0
has 1 name2001-10-19 11:38:13.0
has scope which is the block in which it is declared2001-10-19 11:38:13.0
has type    2001-10-19 11:38:13.0
has lifetime which is the time its block is being executed2001-10-19 11:38:13.0
has purpose to refer to an object or a class or a primitive datum2001-10-19 11:38:13.0
has scope2001-10-19 11:38:13.0
has part value2001-10-19 11:38:13.0
is declared by giving the data type followed by the name of the variable    2001-10-19 11:38:13.0
is destroyed in the block where it is declared2001-10-19 11:38:13.0
may have access modifier 2001-10-19 11:38:13.0
should have comment if it is non-obvious2001-10-19 11:38:13.0
access unithas access mode2001-10-19 11:35:59.0
syntactic unithas syntax rule
bold = mandatory
italic = non-terminal
normal font = optional
2001-10-19 11:38:04.0

Next instance memberinstance method    Upinstance member, member variable