Clone this object. Just call super.clone() to do the work return super.clone();
return super.clone();
Clone1 c = new Clone1(); c.x = 100; c.y = 200; try { Object d = c.clone(); System.out.println("c=" + c); System.out.println("d=" + d); } catch (CloneNotSupportedException ex) { System.out.println("Now that's a surprise!!"); System.out.println(ex); }
Display the current object as a string return "Clone1[" + x + "," + y + "]";
return "Clone1[" + x + "," + y + "]";