[填空题] 下面程序段是从对象流中读取对象,请将程序补充完整。import java. util.*; import java. io.*;public class UnSerializaDate

9 查阅

[填空题] 下面程序段是从对象流中读取对象,请将程序补充完整。

import java. util.*;

import java. io.*;

public class UnSerializaDate

Date d=null;

UnSerializaDate()

try

FileInputStream f=new FileInputStream("date. ser");

ObjectInputStream s=new ObjectInputStream(f);

【13】

f. close();

catch(Exception e)

e. printStackTrace();

public static void main(String args[])

UnSerializaDate a=new UnSerializaDate();

System. out. println("The date read is:" +a.d.toString());

参考答案:

d=(Date)s. readObject();

计算机考试