JAVA Programming :: Exception Handling - Discussion
Home > JAVA Programming > Exception Handling > MCQs Questions Discussion
5 / 4
Choose the correct option.
What is the output for the below code ?
public class A {}
public class B implements Serializable {
private static A a = new A();
public static void main(String... args){
B b = new B();
try{
FileOutputStream fs = new
FileOutputStream("b.ser");
ObjectOutputStream os = new
ObjectOutputStream(fs);
os.writeObject(b);
os.close();
}catch(Exception e){
e.printStackTrace();
}
}
}
ACompilation Fail
Bjavio.NotSerializableException: Because class A is not Serializable.
CNo Exception at Runtime
DNone of the above
Answer: Option (Login/Signup)
Show Explanation
Asked In ::
No Discussion on this question yet!