java序列化代码示例
//序列化
ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("hello.txt"));
oos.writeObject(new String("序列化"));
oos.close();
//反序列化
ObjectInputStream ois = new ObjectInputStream(new FileInputStream("hello.txt"));
Object o = ois.readObject();
String s = (String) o;
ois.close();
System.out.println(s);