📄 serialreadtest.java
字号:
import java.io.*;
import java.util.*;
public class SerialReadTest
{ public static void main(String args[])
{ try
{ ObjectInputStream in = new ObjectInputStream(
new FileInputStream("sample.dat"));
int i = in.readInt();
Date date = (Date)in.readObject();
Address address = (Address)in.readObject();
in.close();
System.out.println("Integer: " + i);
System.out.println("Date: " + date);
System.out.println("Address: " + address);
}
catch(ClassNotFoundException cnfe)
{ System.out.println(cnfe); }
catch(IOException ioe)
{ System.out.println(ioe); }
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -