import java.io.*;

// Beispiel mit Division durch Null, Exception wird abgefangen

public class exception2a {

   private static void pause() {
    try {
      System.out.print("Ende mit Taste"); 
      System.in.read();
    }
    catch (IOException e) {
    }
  }  // pause



   public static int calc(int j) {
   int k=11;
    try {
     k=3/j;
     System.out.println("*********nach division");
    }
    catch (ArithmeticException e) {
         System.err.println("ArithmeticException: " + e);
    }
    System.out.println("in calc,nach catch: k:"+k);
     return k;
   }

  public static void main(String argv[]) {
    int j,k;
    j=1;
    try {
       System.out.println("vor k/j");
       k=3 / j;
       System.out.println("nach 3/j");
       k = calc(j-1);
       System.out.println("nach calc: "+k);
    }
    catch (ArithmeticException e) {
         System.err.println("ArithmeticException: " + e);
    }
    System.out.println("nach catch");
    pause();
  }  // main
}

