← Back to Question List
Java Code Walkthrough #36
Rethrow ArithmeticException
📄 Code
Read carefully — what does this print?1public class Main {2 public static void process(int n) {3 try {4 calculate(n);5 } catch (ArithmeticException e) {6 System.out.println("I");7 throw e;8 }9 }1011 public static void calculate(int x) {12 int result = x / 0;13 }1415 public static void main(String[] args) {16 System.out.println("A");17 try {18 process(5);19 } catch (Exception e) {20 System.out.println("D");21 } finally {22 System.out.println("E");23 }24 }25}