/*
* 对象序列化流:
* ObjectOutputStream:序列化流
* ObjectInputStream:反序列化流
*
* 序列化的对象必须实现了序列化接口
* Serializable
*/
public class Demo5 {
public static void main(String[] args) throws IOException, ClassNotFoundException {
// ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("d.txt"));
//
// Person p = new Person("唐嫣",26);
// oos.writeObject(p);
//
// oos.close();
ObjectInputStream ois = new ObjectInputStream(new FileInputStream("d.txt"));
Object readObject = ois.readObject();
Person p2 = (Person)readObject;