试题详情
- 单项选择题 Assuming that the serializeBanana2() and the deserializeBanana2() methods will correctly use Java serialization and given: import java.io.*; class Food {Food() { System.out.print(”1”); } } class Fruit extends Food implements Serializable { Fruit() { System.out.print(”2”); } } public class Banana2 extends Fruit { int size = 42; public static void main(String [] args) { Banana2 b = new Banana2(); b.serializeBanana2(b); // assume correct serialization b = b.deserializeBanana2(b); // assume correct System.out.println(” restored “+ b.size + “ “); } // more Banana2 methods } What is the result?()
A、 Compilation fails.
B、 1 restored 42
C、 12 restored 42
D、 121 restored 42
E、 1212 restored 42
F、 An exception is thrown at runtime.
- D
关注下方微信公众号,在线模考后查看
热门试题
- 下载并安装JDK软件包,并尝试查看其中的
- Which statement
- 构造方法是否可以被继承?是否可以被重载?
- public static void
- 1. class
- Given an
- A UNIX user named B
- 已知S1=1,S2=1+2,S3=1+2
- Which defines&e
- Given the&ensp
- 以下关于Java包的描述中,错误的是()
- public static&
- Which two
- Click the
- public class&e
- 在Swing GUI编程中,
- 下列关于标识符的叙述正确的是哪项?()&
- 写一个函数,求一个字符串的长度,在mai
- 1. publicQ
- Given: ArrayL