posted 18 years ago
Whenever you declare a variable without the keyword "static," you have an instance variable.
This is all explained in Ko's link above, but let me try my own brief explanation...
You define Java classes, which (usually) include fields (variables) and methods (functions).
The class can serve as a "blueprint" for creating an object, also known as an "instance" of the class (which you create using the keyword "new"). By default, fields and methods are "instance" members, meaning that an instance must be created in order for these fields and methods to be used.
In contrast, fields and methods can be declared "static," in which case they are not associated with any particular instance, but are instead simply associated with the class itself. To use static fields and methods, no instance needs to be created -- they can be called directly from the class.
[ November 12, 2005: Message edited by: marc weber ]
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org