(String[] args)
| 1 | // Program to show ArithmeticException Error handling - |
| 2 | public class arithExceptions { |
| 3 | public static void main(String[] args) { |
| 4 | // try block - |
| 5 | try { |
| 6 | int a = 20, b; |
| 7 | b = a/0; |
| 8 | System.out.println("Value of b = " + b); |
| 9 | } |
| 10 | // catch block - |
| 11 | catch(ArithmeticException e) { |
| 12 | System.out.println("Exception occured!"); |
| 13 | } |
| 14 | // finally block - |
| 15 | finally { |
| 16 | System.out.println("Quit"); |
| 17 | System.out.println("This block will always execute!"); |
| 18 | } |
| 19 | // finally block can be used to catch any exception |
| 20 | } |
| 21 | } |
nothing calls this directly
no outgoing calls
no test coverage detected