Predict the output of the following program.
obj1.a = 10 obj2.a = 20
obj1.a = 20 obj2.a = 20
obj1.a = 10 obj2.a = 10
Explanation: The clone( ) method generates a duplicate copy of the object on which it is called. Only classes that implement the Cloneable interface can be cloned.
Quiz of this Question
Please comment below if you find anything wrong in the above post
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.