June 2006
Intermediate to advanced
1344 pages
42h 52m
English
In Chapter 3, we declared all of an application’s variables in the Main method. Variables declared in the body of a particular method are local variables and can be used only in that method. When a method terminates, the values of its local variables are lost. In contrast, an object’s attributes are carried with the object as it is used in a program. Such attributes exist before a method is called on the object, while the method is executing, and after the method completes execution.
Attributes are represented as variables in a class declaration. Such variables are called instance variables and are declared inside a class declaration but outside the bodies of the class’s other members, such as methods (and ...
Read now
Unlock full access