blob: bf3ade778b298e7722d5813eb66f3d8137cf2757 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
/* Listing4105.java */
import java.io.*;
import java.util.*;
public class Listing4105
{
public static void main(String[] args)
{
try {
FileInputStream fs = new FileInputStream("test2.ser");
ObjectInputStream is = new ObjectInputStream(fs);
System.out.println("" + is.readInt());
System.out.println((String)is.readObject());
Time time = (Time)is.readObject();
System.out.println(time.toString());
time = (Time)is.readObject();
System.out.println(time.toString());
is.close();
} catch (ClassNotFoundException e) {
System.err.println(e.toString());
} catch (IOException e) {
System.err.println(e.toString());
}
}
}
|