A.main
B.void
C.args
第6题
注意:请勿改动main()主方法和其他已有语句内容,仅在下划线处填入适当的语句。程序运行结果如下:
ex3_2: i=123 d=123.456
ex3_2: i=123 d=123.456
import java.io.*;
public class ex3_2 implements Serializable {
private int n3_2;
private double d3_2;
ex3_2() {
n3_2 = 25;
d3_2 = 12.23;
}
public void setDouble(double x) {
d3_2 = x;
}
public void setInt(int x) {
n3_2 = x;
}
public String toString() {
return("ex3_2: i=" + n3_2 + "d=" + d3_2);
}
public static void main(String[] arg) {
ex3_2 e1 = new ex3_2 );
ex3_2 e2;
e1.setInt(123);
e1.setDouble(123.456);
System.out.println(e1);
try {
FileOutputStream fos3_2 = new FileOutputStream("ex3_2.data");
ObjectOutputStream oos3_2 = new ObjectOutputStream(fos3_2);
________________;
} catch(IOException ioe) {
System.out.println(ioe);
}
try {
FileInputStream fis3_2 = new FileInputStream("ex3_2.data");
ObjectInputStream ois3_2 = new ObjectInputStream(fis3_2);
________________;
System.out.println(e2);
}catch(10Exception ioe) {
System.out.println(ioe);
}catch(ClassNotFoundException cnfe) {
System.out.println(cnfe);
}
}
}
第8题
为了保护您的账号安全,请在“上学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!