"Life is like riding a bicycle. To keep your balance you must keep moving."
- Albert Einstein
What will be the output of the program?
public class RTExcept
public static void throwit ()
throw new RuntimeException();
public static void main(String  args)
catch (Exception re )
[A]. hello throwit caught
[B]. Compilation fails
[C]. hello throwit RuntimeException caught after
[D]. hello throwit caught finally after
Option Answer: B
main() method properly catches and handles the RuntimeException in the catch block, finally runs (as it always does), and then the code returns to normal.
A, B and C are incorrect based on the program logic described above. Remember that properly handled exceptions do not cause the program to stop executing.
(Fri, Mar 8, 2013 01:22:42 AM)
Since RuntimeException is not a subclass of Exception class and neither it needs to be declared or handle then how can a catch clause with Exception object as argument can handle this Runtime Exception?
Write your comments here: