AssumingthattheserializeBanana()andthedeserializeBanana()methodswillcorrectlyuseJavaserializationandgiven:
importjava.io.*;
classFoodimplemerttsSerializable{intgood=3;}
classFruitexterndsFood{intjuice=5;}
publicclassBananaextendsFruit{
intyellow=4;
publicstaticvoidmain(String[]args){
Bananab=newBanana();Bananab2=newBanana();
b.serializeBanana(b);//assumecorrectserialization
b2=b.deserializeBanana();//assumecorrect
System.out.println(”restore+b2.yellow+b2.juice+b2.good);
}
//moreBananamethodsgohere
}
Whatistheresult?()
时间:2024-04-06 12:42:53
相似题目