Interview Questions

If a class A is extended by class B and class B wants to provide the cloning feature. Then what should the class do?

Java Interview Questions for Cloning and Cloneable


(Continued from previous question...)

If a class A is extended by class B and class B wants to provide the cloning feature. Then what should the class do?

The super class A should also override and provide a valid clone of itself through the clone method. Class Bs clone method will invoke super.clone() and modify the behaviour of member instance variables and return the proper clone.

(Continued on next question...)

Other Interview Questions