Java IO Serialization
© examsiri.com
Question : 2 of 17
Marks:
+1,
-0
Given:
What is the result?
1. import java.io.*;
2. public class Forest implements Serializable {
3.   private Tree tree = new Tree();
4.   public static void main(String [] args) {
5.    Forest f = new Forest();
6.    try {
7.     FileOutputStream fs = new FileOutputStream("Forest.ser");
8.     ObjectOutputStream os = new ObjectOutputStream(fs);
9.     os.writeObject(f); os.close();
10.    } catch (Exception ex) { ex.printStackTrace(); }
11.   }
12.}
13. class Tree { }What is the result?
Go to Question: