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);//assumecorrectserializationb=b.deserializeBanana2(b);//assumecorrectSystem.out.println(”restored+b.size+);}//moreBanana2methods}Whatistheresult?()

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?()


相关考题: