通过流克隆对象
/* 来自 *NowJava.com*/ //package com.nowjava; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; public class Main { public static void main(String[] argv) throws Exception { Object obj = "nowjava.com"; System.out.println(cloneObject(obj)); } /** * Clone Object * @param obj * @return * @throws Exception */ public static Object cloneObject(Object obj) throws Exception {/* 来自 nowjava.com - 时代Java*/ ByteArrayOutputStream byteOut = new ByteArrayOutputStream(); ObjectOutputStream out = new ObjectOutputStream(byteOut); out.writeObject(obj); ByteArrayInputStream byteIn =