Written by the Fiveable Content Team • Last updated August 2025
Verified for the 2026 exam
Verified for the 2026 exam•Written by the Fiveable Content Team • Last updated August 2025
Definition
The new keyword is used in Java to create an instance (object) of a class. It allocates memory for the object and initializes its attributes using the constructor method.
An instance variable is a variable declared within a class but outside any method. Each instance/object of that class has its own copy of these variables.
A reference variable holds the memory address/reference of an object rather than the actual object itself. It allows us to access and manipulate objects indirectly.