import java.io.*;
class ABC implements Serializable { }
public class SerializeABC {
public static void main(String[] args) {
ABC ab = new ABC();
try {
FileOutputStream fs = newFileOutputStream(“testSer.ser”);
ObjectOutputStream os = new ObjectOutputStream(fs);
os.writeObject(ab);
os.close();
} catch (Exception e) { e.printStackTrace(); }
try {
FileInputStream fis = new FileInputStream(“testSer.ser”);
ObjectInputStream ois = new ObjectInputStream(fis);
ab = (ABC) ois.readObject();
ois.close();
} catch (Exception e) { e.printStackTrace(); }
}
}
Responses to “What will be the output of the following code?”