题目
注意:请勿修改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 S=new FileOutputStream("TheSerial.data");
ObjectOutputStream OS=new ObjectOutputStream(oS);
______;
}
catch(IOException ioException)
{
System.out.println (ioException.getMessage ());
}
try
{
FileInputStream iS=new FileInputStream("TheSerial.data");
ObjectInputStream IS=new ObjectInputStream(iS);
______;
System.out.println(e2);
}
catch(IOException ioException)
{
System.out.println(ioException.getMessage());
}
catch(ClassNotFoundException cnfException)
{
System.out.println(cnfException.getMessage());
}
}
}
第1题
注意:请勿改动main()主方法和其他已有语句内容,仅在横线处填入适当语句。
import java.io.*;
class TheSerial implements Serializable
{
private int intValue;
private double doubleValue;
private String string;
TheSerial()
{
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 toString()
{
return("int="+intValue+"double="+doubleValue+" string="+string);
}
}
public class Example2_3
{
public static void main(String argv[])
{
TheSerial e1 = new TheSerial();
TheSerial e2;
try
{
e1.setInt(Integer.parseInt(argv[0]));
e1.setDouble(Double.parseDouble(argv[1]));
e1.setString[argv[2]);
}
catch(Exception e)
{
e1.setString(e.getMessage{));
}
System.out.println(e1);
try
{
FileOutputStream S = new FileOutputStream("TheSerial.data");
ObjectOutputStream IS = new ObjectOutputStream(oS);
______;
}
catch(IOException ioException)
{
System.out.println(ioException.getMessage());
}
try
{
FileInputStream iS = new FileInputStream("TheSerial. data");
ObjectInputStream IS = new ObjectInputStream(iS);
______
System.out.println(e2);
}
catch(IOException ioException)
{
System.out.println(ioException.getMessage());
}
catch(ClassNotFoundException cnfException)
{
System.out.println(cnfException.getMessage());
}
}
}
第3题
A.公司级关键举措与行动计划评价人:总经理
B.部门关键举措与行动计划评价人:部门经理
C.会议决策和重大事项评价人:任务发布者、总经理
D.涉及施工类专项工作内容评价人:工程部
第5题
注意:请勿改动main()主方法和其他已有语句内容,仅在下划线处填入适当的语句。
程序运行结果如下:
public class ex35_2
{
public static void main(String args[ ])
{
Runnable b1=new B("First");
Runnable b2=new B("Second");
Runnable b3=new B("Third");
Thread t1=new Thread(b1);
Thread t2=new Thread(b2);
Thread t3=new Thread(b3);
t1.start ();
t2.start ();
t3.start();
}
}
class B _____________________ Runnable
{
String s;
public B(String str)
{
s=str;
}
_________________
{
for(int i=1;i<3;i++)
{
System. out. println (s+ "运行!");
try
{
Thread.sleep((int) (Math.random() *100) );
}
catch (InterruptedException e)
{
e.printStackTrace ();
}
}
System. out.println (s+"结束!");
}
}
为了保护您的账号安全,请在“赏学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!