Hi,
Source : javablackbelf.com
1)
If a Runtime Exception is thrown in the finalize method
a)The running application crashes.
b)The exception is simply ignored and the object is garbage collected.
c)The exception is simply ignored, but the object is not garbage collected.
d)The Exception causes the JVM to crash.
My Answer is : d). JVM wont collect the object when the runtime exception occurs. Then it garbage collects it next time wihtout calling the finalize() method.
correct answer given is : b)
2)
When does the JVM exit?
a)After the main method returns.
b)After all the non-daemon threads created by the application complete.
c)After all the daemon threads created by the application complete
d)When a
thread executes System.exit();
e)When an uncaught exception is thrown in a non-demon thread.
f)When an uncaught exception is thrown in a demon thread.
My Answer is : b) , d), e)
Correct answers given is b), d)
Can any one explain me these as per answers?
rami