Consider the following program:
class Main {/*w ww . java2 s . c o m*/ public static void main(String []args) { try { assert false; } catch (RuntimeException re) { System.out.println("In the handler of RuntimeException"); } catch (Exception e) { System.out.println("In the handler of Exception"); } catch (Error ae) { System.out.println("In the handler of Error"); } catch (Throwable t) { System.out.println("In the handler of Throwable"); } } }
This program is invoked in the command line as follows:
java Main
Which one of the following options correctly describes the behavior of this program?
f)
Since asserts are disabled by default, the program does not raise an AssertionError, so the program does not generate any output and terminates normally.
If the program were invoked by passing -ea in the command line, it would have printed "In the handler of Error" (since the program would have thrown an AssertionError).