请完成程序,首先由一个类simple实现Serializable接口,并有三个成员变

题型:问答题

问题:

请完成程序,首先由一个类simple实现Serializable接口,并有三个成员变量,分别为int型、double型和String型,可以用toString的方法显示这三个成员变量。在main方法中创建这个simple的持久对象,根据用户在命令行输入的三个参数来设定其中成员变量的值。然后,将这个对象写入名为TheSerial.data的文件中,并显示成员变量。最后从文件TheSerial.data中读出三个成员变量并显示出来。
注意:请勿修改main()主方法和其他已有语句内容,仅在横线处填入适当语句。
import java.io.*;
class TheSerial implements Serializable

private int intvalue;
private double doublevalue;
private String string;
The Serial ()

intvalue=123;
doublevalue=12.34;
string="Serialize Test";

public void setDouble(double d)

doublevalue=d;

public void setInt(int i)

intvalue=i;

public void setString(String s)

string=s;

public String to String()

return("int="+intvalue+" double="+doublevalue+" string="+string);


public class simple

public static void main(String[] args)

The Serial e1=new TheSerial();
TheSerial e2;
try

e1.setInt(Integer.parseInt(args[0]));
e1.setDouble(Double.parseDouble(args[1]));
e1.setString(args[2]);

catch(Exception e)

e1.setString(e.getMessage());

System.out.println(e1);
try

FileOutputStream oS=new FileOutputStream("TheSerial.data");
ObjectOutputStream oOS=new ObjectOutputStream(oS);
______;

catch(IOException ioException)

System.out.println (ioException.getMessage ());

try

FileInputStream iS=new FileInputStream("TheSerial.data");
ObjectInputStream oIS=new ObjectInputStream(iS);
______;
System.out.println(e2);

catch(IOException ioException)

System.out.println(ioException.getMessage());

catch(ClassNotFoundException cnfException)

System.out.println(cnfException.getMessage());


考点:计算机等级考试JAVA二级JAVA机试
题型:问答题

项目验收完成后,由()出具验收报告。验收报告必须有()签字、()盖章。

A、验收组、验收人员、项目审批单位

B、电子银行部、软件开发中心、电子银行部

C、电子银行部、软件开发中心、项目审批单位

D、验收组、软件开发中心、电子银行部

题型:问答题

一辆汽车从甲地开往乙地,所用时间为10 s,假设甲乙两地的直线距离是100 m,路程是150 m,问该汽车的平均速度和平均速率如何?

题型:问答题
下列仪器或工具在使用过程中,属于杠杆的一组是 (   )       

①量筒②剪刀③烧杯④试管夹⑤托盘天平⑥弹簧测力计  

A.①②③    

B.②④⑤    

C.①③⑤    

D.④⑤⑥

题型:问答题

下列与口腔感染性疾病有关的细菌,能够产生黑色素的是()。

A.放线菌属

B.韦荣球菌

C.拟杆菌属

D.普氏菌属

E.梭杆菌属

题型:问答题

某企业现有一台旧设备,尚可继续使用5年,预计5年后残值为5000元,目前出售可获 40000元。使用该设备每年的营业收入为800000元,经营成本为400000元。同时市场上相同类型的设备,价值为100000元,预计5年后残值为 8000元。使用新设备将使每年经营成本增加20000元。该企业所得税税率为30%。
要求:用差量分析法计算新、旧设备的差量现金流。

更多题库