题目内容
AssumingthattheserializeBanana2()andthedeserializeBanana2()methodswillcorrectlyuseJavaserializationandgiven:
importjava.io.*;
classFood{Food(){System.out.print(”1”);}}
classFruitextendsFoodimplementsSerializable{
Fruit(){System.out.print(”2”);}}
publicclassBanana2extendsFruit{intsize=42;
publicstaticvoidmain(String[]args){
Banana2b=newBanana2();
b.serializeBanana2(b);//assumecorrectserialization
b=b.deserializeBanana2(b);//assumecorrect
System.out.println(”restored+b.size+);}
//moreBanana2methods
}
Whatistheresult?()
查看答案
搜索结果不匹配?点我反馈
更多问题