I've come across an exercise while preparing my OCA, i don't understand why the program print : abce 3
instead of abcde 3
. Here the program :
'public static void main(String[] args) {
System.out.print("a");
try{
System.out.print("b");
throw new IllegalArgumentException();
}catch(IllegalArgumentException e){
System.out.print("c");
throw new RuntimeException("1");
}catch(RuntimeException e) {
System.out.print("d");
throw new RuntimeException("2");
}finally {
System.out.print("e");
throw new RuntimeException("3");
}
}'
Any explanations why it ignores the last catch block will be really appreciated!