KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > lang > Cloneable


1 /*
2  * @(#)Cloneable.java 1.16 04/01/17
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package java.lang;
9
10 /**
11  * A class implements the <code>Cloneable</code> interface to
12  * indicate to the {@link java.lang.Object#clone()} method that it
13  * is legal for that method to make a
14  * field-for-field copy of instances of that class.
15  * <p>
16  * Invoking Object's clone method on an instance that does not implement the
17  * <code>Cloneable</code> interface results in the exception
18  * <code>CloneNotSupportedException</code> being thrown.
19  * <p>
20  * By convention, classes that implement this interface should override
21  * <tt>Object.clone</tt> (which is protected) with a public method.
22  * See {@link java.lang.Object#clone()} for details on overriding this
23  * method.
24  * <p>
25  * Note that this interface does <i>not</i> contain the <tt>clone</tt> method.
26  * Therefore, it is not possible to clone an object merely by virtue of the
27  * fact that it implements this interface. Even if the clone method is invoked
28  * reflectively, there is no guarantee that it will succeed.
29  *
30  * @author unascribed
31  * @version 1.16, 01/17/04
32  * @see java.lang.CloneNotSupportedException
33  * @see java.lang.Object#clone()
34  * @since JDK1.0
35  */

36 public interface Cloneable {
37 }
38
Popular Tags