martes, 10 de enero de 2012

Manejo de dos excepciones en un mismo programa

import java.io.*;
public class vector {

public static void main(String args[]) throws IndexOutOfBoundsException,ArithmeticException

{
double x;
int i[]=new int[10];
int j;
try {




    i[5]=10;
    i[5]=i[5]/0;
     i[11]=32;

}
 catch (IndexOutOfBoundsException a) {

  System.out.println("Error=>"+a);
}

catch(ArithmeticException ar)

{
System.out.println("Error=>"+ar);

}
}
}

No hay comentarios:

Publicar un comentario