< prev index next >

src/java.base/share/classes/java/lang/CloneNotSupportedException.java

Print this page




  26 package java.lang;
  27 
  28 /**
  29  * Thrown to indicate that the <code>clone</code> method in class
  30  * <code>Object</code> has been called to clone an object, but that
  31  * the object's class does not implement the <code>Cloneable</code>
  32  * interface.
  33  * <p>
  34  * Applications that override the <code>clone</code> method can also
  35  * throw this exception to indicate that an object could not or
  36  * should not be cloned.
  37  *
  38  * @author  unascribed
  39  * @see     java.lang.Cloneable
  40  * @see     java.lang.Object#clone()
  41  * @since   1.0
  42  */
  43 
  44 public
  45 class CloneNotSupportedException extends Exception {

  46     private static final long serialVersionUID = 5195511250079656443L;
  47 
  48     /**
  49      * Constructs a <code>CloneNotSupportedException</code> with no
  50      * detail message.
  51      */
  52     public CloneNotSupportedException() {
  53         super();
  54     }
  55 
  56     /**
  57      * Constructs a <code>CloneNotSupportedException</code> with the
  58      * specified detail message.
  59      *
  60      * @param   s   the detail message.
  61      */
  62     public CloneNotSupportedException(String s) {
  63         super(s);
  64     }
  65 }


  26 package java.lang;
  27 
  28 /**
  29  * Thrown to indicate that the <code>clone</code> method in class
  30  * <code>Object</code> has been called to clone an object, but that
  31  * the object's class does not implement the <code>Cloneable</code>
  32  * interface.
  33  * <p>
  34  * Applications that override the <code>clone</code> method can also
  35  * throw this exception to indicate that an object could not or
  36  * should not be cloned.
  37  *
  38  * @author  unascribed
  39  * @see     java.lang.Cloneable
  40  * @see     java.lang.Object#clone()
  41  * @since   1.0
  42  */
  43 
  44 public
  45 class CloneNotSupportedException extends Exception {
  46     @java.io.Serial
  47     private static final long serialVersionUID = 5195511250079656443L;
  48 
  49     /**
  50      * Constructs a <code>CloneNotSupportedException</code> with no
  51      * detail message.
  52      */
  53     public CloneNotSupportedException() {
  54         super();
  55     }
  56 
  57     /**
  58      * Constructs a <code>CloneNotSupportedException</code> with the
  59      * specified detail message.
  60      *
  61      * @param   s   the detail message.
  62      */
  63     public CloneNotSupportedException(String s) {
  64         super(s);
  65     }
  66 }
< prev index next >