Hello Ranchers
This is the question from
SCJP(310-055) exam guide by kathy Siera and Bert Bates, page no:501 Question no:6
import java.io.*;
Class Keyboard
{
}
public class Computer implements Serializable
{
private Keyboard k=new Keyboard();
public static void main(
String[]args)
{
Computer c=new Computer();
c.storeIt(c);
}
void storeIt(Computer c)
{
try{
ObjectOutputStream os=new ObjectOutputStream(new FileOutputStrea("myfile"));
os.writeObject(c);
os.close();
System.out.println("done");
}
catch(Exception e)
{
System.out.println("exe");
}
}
}
Answers(choose all the apply)
a)exe
b)done
c)Compilation fails
d)Exactly one object is serialized
e)exactly two objects are serialized
answer is given as A, my doubt why cant answer be A,B and D, because here only one object is Serialized that is c.
[ February 09, 2008: Message edited by: gobburi saikrishna ]