package com.d04_file.itheima12; import java.io.FileInputStream; import java.io.IOException; import java.io.ObjectInputStream; //反对象序列化流,从文件中读取对象信息 public class ObjectInputStreeamDemo { public static void main(String[] args) throws IOException, ClassNotFoundException { ObjectInputStream ois = new ObjectInputStream(new FileInputStream("src\\com\\d04_file\\itheima12\\oos.txt")); Object obj = ois.readObject(); Student s = (Student) obj; System.out.println(s.getName()+","+s.getAge()); } }