Java IO Serialization
© examsiri.com
Question : 17 of 17
Marks:
+1,
-0
Given:
Which are true? (Choose all that apply.)
import java.io.*;
public class TestSer {
  public static void main(String[] args) {
   SpecialSerial s = new SpecialSerial();
    try {
    ObjectOutputStream os = new ObjectOutputStream(new FileOutputStream("myFile"));
    os.writeObject(s); os.close();
    System.out.print(++s.z + " ");
    ObjectInputStream is = new ObjectInputStream(new FileInputStream("myFile"));
    SpecialSerial s2 = (SpecialSerial)is.readObject();
    is.close();
    System.out.println(s2.y + " " + s2.z);
   } catch (Exception x) {System.out.println("exc"); }
  }
}
class SpecialSerial implements Serializable {
  transient int y = 7;
  static int z = 9;
}Which are true? (Choose all that apply.)
Go to Question: