Please enable JavaScript to use CodeHS

AP CSA: MOD-2.B.4

CodeHS Lessons

When a mutable object is a constructor parameter, the instance variable should be initialized with a copy of the referenced object. In this way, the instance variable is not an alias of the original object, and methods are prevented from modifying the state of the original object.

Standard
5.2 Constructors
Standard
4.11 Key Terms for Classes
Standard
8.2 Constructors
Standard
6.11 Key Terms for Classes
Standard
11.2 Constructors
12.11 Key Terms for Classes
Standard
11.2 Constructors
18.11 Key Terms for Classes
Standard
6.11 Key Terms for Classes