public class Try4 {
public static void main(String[] args) {
int [] array = new int[20];
try{
//array[-3] = 24;
int b = 0;
int a = 23/b;
String s= null;
s.equals("QQQQ");
}
catch(ArrayIndexOutOfBoundsException exception){
System.out.println(" Error de indice en un array.");
}
catch(ArithmeticException exception){
System.out.println("Error de division por cero.");
}
catch(Exception exception){
System.out.println("Se ha generado un error que no es de indice en un array, ni aritmetico.");
System.out.println("El objeto error es de tipo "+ exception);
}
}
}
No hay comentarios:
Publicar un comentario