Bidvertiser

Jumat, 01 April 2011

Demonstrate multiple catch statements.

 
class MultiCatch {
  public static void main(String args[]) {
    try {
      int a = args.length;
      System.out.println("a = " + a);
      int b = 42 / a;
      int c[] };
      c[4299;
    catch (ArithmeticException e) {
      System.out.println("Divide by 0: " + e);
    catch (ArrayIndexOutOfBoundsException e) {
      System.out.println("Array index oob: " + e);
    }
    System.out.println("After try/catch blocks.");
  }
}

0 komentar:

Posting Komentar

Bidvertiser