quiz7_5.java

来自「北京大学出版社的」· Java 代码 · 共 17 行

JAVA
17
字号
public class Quiz7_5 implements Cloneable {
   StringBuffer sb
      = new StringBuffer( "Good morning!" );
   public Object clone()
            throws CloneNotSupportedException {
      Quiz7_5 result = (Quiz7_5) super.clone();
      result.sb = this.sb;
      return result;
   }
   public static void main( String[] args )
         throws CloneNotSupportedException {
      Quiz7_5 x = new Quiz7_5();
      Quiz7_5 y = (Quiz7_5) x.clone();
      x.sb.append( " How are you today?" );
      System.out.println( y.sb );
   }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?