⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testclone.java

📁 java课件及例程有一些PPT及一些例程
💻 JAVA
字号:
public class TestClone implements Cloneable{
   int a=7;
   int b=4;
   public static void main(String args[]){
       TestClone x= new TestClone();
       TestClone y,z;
       try{
       	   z=x;
           //y= x.clone();
           y= (TestClone)x.clone();
           System.out.println("b.a = "+y.a+",y.b = "+y.b); 
           System.out.println("x.a = "+x.a+",x.b = "+x.b);
           System.out.println("y=x?"+y.equals(x)+"z=x?"+z.equals(x));
           x.b=60;
           System.out.println("b.a = "+y.a+",y.b = "+y.b); 
           System.out.println("x.a = "+x.a+",x.b = "+x.b);
           System.out.println("z.a = "+z.a+",z.b = "+z.b);
           System.out.println("y=x?"+y.equals(x)+"z=x?"+z.equals(x));
           System.out.println("x.getClass() is: "+x.getClass().toString());
       }catch(Exception e){System.out.println(e.toString());}
   } 
}

⌨️ 快捷键说明

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