📄 testclone.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 + -