ObjectInputStream 对象流

 //https://www.cnblogs.com/elleniou/archive/2012/08/29/2662353.html
  //不能循环写入否则修改源码
/*  for (Student student1 : arr) {
      oos.writeObject(student1);
  }*/
    ObjectInputStream ois  = new ObjectInputStream(new FileInputStream("list.txt"));
    //ArrayList<Student> list  = (ArrayList<Student>)ois.readObject();
   Student list  = (Student)ois.readObject();
/*    for (int i = 0; i < list.size(); i++ ){
        Student s = list.get(i);
        System.out.println(s);
    }*/
    System.out.println(list);

猜你喜欢

转载自blog.csdn.net/qq_34627002/article/details/89016867