Advertisement
virtualideaz

TryCatch.java

Mar 26th, 2015
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.33 KB | None | 0 0
  1. public class TryCatch {
  2.  
  3.     public static void main(String[] args) {
  4.         int num=7, denom=0, result;
  5.        
  6.         try {
  7.             result = num/denom;
  8.             }
  9.         catch (ArithmeticException mistake)
  10.               {
  11.                 System.out.println("Attempt to divide by zero");
  12.               }
  13.     }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement