666 B
666 B
Lecture 1 (11:00) - Class Definitions
- String is capitalised due to it being a class.
Scope
- Parameter can only be accessed from the body of the method in which it is declared. We can say its scope is restricted to the body of the method.
- The scope of a field variable is the body of the class it is declared in.
Lifetime and Accessor Methods
- Lifetime of a parameter of a method is the duration of a particular call to a method.
- Value is lost when call completed
- Lifetime of an objects field variable is the lifetime of the object itself
- Accessor method allows access to the value of a field without changing the state of an object