Advertisement
Guest User

Untitled

a guest
Apr 4th, 2020
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.42 KB | None | 0 0
  1. class TestExceptions {
  2.  
  3.    public static void main(String  args[]) {
  4.       int d, a;
  5.       try {
  6.         d = 0;
  7.         a = 42 / d;
  8.         System.out.println("This will not be printed.");
  9.       } catch (ArithmeticException e) {
  10.         System.out.println("Division by zero.");
  11.       } finally {
  12.         System. out. println( "Finally") ;
  13.       }
  14.       System.out.println("Out of try/catch/finally - statement");
  15.    }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement