class test { }

public class test1 implements Serializable
{
private test k = new test();

public static void main(String[] args)
{
test1 c = new test1 ();
c.store(c);
}

void store (test1 c)
{
try {
ObjectOutputStream os = new ObjectOutputStream(
new FileOutputStream("myFile"));
os.writeObject(c);
os.close();
System.out.println("done");
}
catch (Exception x)
{
System.out.println("out");
}
}

}

What would be the result?

Options
- out
- done
- compile error
- One object is serialized


CORRECT ANSWER : out

Discussion Board
solution

gives java.io.NotSerializableException: Test

Manish Malaviya 11-20-2014 11:36 PM

Write your comments


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)


Advertisement