1.

What do you understand by Object Cloning and how do you achieve it in Java?

Answer»
  • It is the process of CREATING an exact copy of any object. In ORDER to support this, a java class has to implement the Cloneable interface of java.lang package and override the clone() method PROVIDED by the Object class the syntax of which is:
protected Object clone() THROWS CloneNotSupportedException{ RETURN (Object)super.clone();}
  • In case the Cloneable interface is not implemented and just the method is overridden, it results in CloneNotSupportedException in Java.


Discussion

No Comment Found