Friday, April 12, 2019

exception handling

public class cl {
   public static void main(String args[]){
      int d = 0;
      int n = 20;
      int fraction = n/d;
     System.out.println("End Of Main");
   }
}


$javac cl.java
$java -Xmx128M -Xms16M cl
Exception in thread "main" java.lang.ArithmeticException: / by zero
 at cl.main(cl.java:5)

No comments:

Post a Comment