万能百科  > 计算机   > 

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

2021-07-20   

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

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();

词条内容仅供参考,如果您需要解决具体问题
(尤其在法律、医学等领域),建议您咨询相关领域专业人士。

标签