The Object class provides a clone() method, which returns a copy of the current object. : clone method « Utility Classes « SCJP

Home
SCJP
1.Java Source And Data Type
2.Operators
3.Modifiers
4.Type Casting
5.Statements
6.Object Oriented
7.Thread
8.Utility Classes
9.File
SCJP » Utility Classes » clone method 
8.5.1.The Object class provides a clone() method, which returns a copy of the current object.
public class MainClass {
  public static void main(String[] argv) {
    MyClass my = new MyClass();
    System.out.println(my.toString());
  }
}

class MyClass {

  public Object clone() throws CloneNotSupportedException {
    return super.clone();
  }

}
8.5.clone method
8.5.1.The Object class provides a clone() method, which returns a copy of the current object.
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.