Java IO Serialization

© examsiri.com
Question : 6 of 17
 
Marks: +1, -0
Assuming that the serializeBanana2() and the deserializeBanana2() methods will correctly use Java serialization and given:
1. import java.io.*;
2. class Food {Food() { System.out.print("1"); } }
3. class Fruit extends Food implements Serializable {
4.   Fruit() { System.out.print("2"); } }
5. public class Banana2 extends Fruit { int size = 42;
6.   public static void main(String [] args) {
7.    Banana2 b = new Banana2();
8.    b.serializeBanana2(b); /* assume correct serialization*/
9.    b = b.deserializeBanana2(b); /* assume correct*/
10.    System.out.println(" restored " + b.size + " "); }
11. /* more Banana2 methods*/
12. }

What is the result?
Go to Question: