Difficulty: Easy
Correct Answer: 0 42 42
Explanation:
Introduction / Context:
This problem examines Java's pass-by-value of references and default field initialization for primitive types inside objects.
Given Data / Assumptions:
Concept / Approach:
Java passes object references by value. Mutating the object via any reference affects the single underlying object instance. Primitives inside objects default to zero if not explicitly set.
Step-by-Step Solution:
Verification / Alternative check:
Insert an identity check like (t == t2) to confirm both references point to the same object.
Why Other Options Are Wrong:
They assume separate copies or null/default misunderstandings that do not apply here.
Common Pitfalls:
Confusing Java with pass-by-reference semantics; Java always passes by value, but the value of a reference lets you mutate the object.
Final Answer:
0 42 42
Discussion & Comments