Java IO Serialization
© examsiri.com
Question : 4 of 17
Marks:
+1,
-0
Assuming that the serializeBanana() and the deserializeBanana() methods will correctly use Java serialization and given:
What is the result?
1. import java.io.*;
2. class Food implements Serializable {int good = 3;}
3. class Fruit extends Food {int juice = 5;}
4. public class Banana extends Fruit {
5.   int yellow = 4;
6.   public static void main(String [] args) {
7.    Banana b = new Banana(); Banana b2 = new Banana();
8.    b.serializeBanana(b); /* assume correct serialization*/
9.    b2 = b.deserializeBanana(); /* assume correct*/
10.    System.out.println("restore "+b2.yellow+ b2.juice+b2.good);
11.   }
12. /* more Banana methods go here 50.*/ }What is the result?
Go to Question: