| 12345678910111213141516171819202122 |
- package course;
- import java.io.FileInputStream;
- import java.io.IOException;
- import java.io.ObjectInputStream;
- /**
- * @author WanJl
- * @version 1.0
- * @title ObjectInputStreamTest
- * @description
- * @create 2026/8/8
- */
- public class ObjectInputStreamTest {
- public static void main(String[] args) throws IOException, ClassNotFoundException {
- //创建反序列化对象
- ObjectInputStream ois = new ObjectInputStream(new FileInputStream("D:/studentObject.txt"));
- //调用方法进行反序列化
- Object o = ois.readObject();
- System.out.println(o);
- }
- }
|