← Quiz: Shallow and Deep Copy: all 10 questions
Quiz: Shallow and Deep Copy · Question 3 of 10
What does super.clone() do inside a class that implements Cloneable?
What does super.clone() do inside a class that implements Cloneable?
- A.Calls the class's constructor again
- B.Creates a deep copy of every field
- C.Returns the same object
- D.Creates a new object and copies each field value as it is
Answer & explanation
Correct answer: Creates a new object and copies each field value as it is
Object.clone() makes a field-by-field (shallow) copy without running a constructor.
Can you get the rest right without peeking?
Take the timed Quiz: Shallow and Deep Copy quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →