对象的反序列化流

package com.czie.iot1913.lps.IO.ObjectStream;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;

/**
* FileName: ObjectInPutStreamDemo
* Author: lps
* Date: 2022/3/28 16:35
* Sign:刘品水 Q:1944900433
* Object readObject()
* 从对象输入流对象。
*/
public class ObjectInPutStreamDemo {
public static void main(String[] args) throws IOException, ClassNotFoundException {
ObjectInputStream ois = new ObjectInputStream(new FileInputStream("F:\\JavaCode\\oos.txt"));
Object obj = ois.readObject();
Student s = (Student) obj;
System.out.println(s);
//System.out.println(s.getName()+","+s.getAge());
ois.close();



}
}

 

posted @ 2022-03-28 17:43  刘品水  阅读(21)  评论(0编辑  收藏  举报