Java IO Serialization
© examsiri.com
Question : 10 of 17
Marks:
+1,
-0
Which code, inserted at line 14, will allow this class to correctly serialize and deserialize?
1. import java.io.*;
2. public class Foo implements Serializable {
3.   public int x, y;
4.   public Foo( int x, int y ) { this.x = x; this.y = y;}
5.
6.   private void writeObject ( ObjectOut put Stream s)
7.    throws IOException {
8.    s.WriteInt (x); s.WriteInt (y);
9.   }
10.
11.   private void readObject( ObjectInputStream s)
12.    throws IOException, ClassNotFoundException {
13.
14    /* insert code here */
15.
16.   }
17. }
Go to Question: