标签:tcl name code ble 序列 try test logs blog
1 ackage com.wisezone.clone; 2 3 /** 4 * 空接口: 5 * 标识,告诉JVM,通行 6 * 1、克隆 7 * 2、序列化 8 * 9 * 创建对象的第二种方式:克隆clone,要实现Cloneable 10 * @author 王东海 11 * @2017年4月15日 12 */ 13 public class TestClone implements Cloneable 14 { 15 public String name; 16 17 public static void main(String[] args) 18 { 19 TestClone t1 = new TestClone(); 20 t1.name = "zs"; 21 System.out.println(t1.name); 22 23 try 24 { 25 TestClone t2 = (TestClone) t1.clone(); 26 t2.name = "ww"; 27 System.out.println(t2.name); 28 } catch (CloneNotSupportedException e) 29 { 30 e.printStackTrace(); 31 } 32 } 33 }
创建对象的第二种方式:克隆clone,要实现Cloneable接口
标签:tcl name code ble 序列 try test logs blog
原文地址:http://www.cnblogs.com/wdh1995/p/6716347.html