The following Q is from RHE chap 5. I am not sure that I get these are points right? Please help me! Thanks!
1. finally is not a "final catch" or is not a kind of "catch(...)" in c++. finally is just a simple "printf" statement? If finally is not a "finally catch", why need it?
2. if an exception is not catched, The excecution exits the method IMMEDIATLY? True or False?
try{
URL u=new URL(path);//assume path is a previously defined
String Object obj=in.readObject();// in is a valid ObjectInputStream
System.out.println("Success");
}
catch(MalformedURLException e){
System.out.println("Bad URL");
}
catch(StreamCorruptedException e){
System.out.println("Bad File Contents");
}
catch(Exception e){
System.out.println("General Exception");
}
finally{
System.out.println("Finally Part");
}
System.out.println("Carrying On");
What lines are output if the code at the line 3 throws a OutOfMemoryError? Choose all valid answers.
a. Success
b. Bad URL
c. Bad File Contents
d. General Exception
e. Finally part
f. Carrying On
Ans: e