sábado, 6 de julio de 2013

EXCEPCIONES

EJERCICIO  "10"


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package excepciones;

/**
 *
 * @author GATO
 */
public class Excepciones {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        String alumno [] = new String[5];
        alumno[0]= "DIEGUITO";
        alumno[1]= "DEIBY";
        alumno[2]= "KLEVER";
        alumno[3]= "JOSVIN";
        alumno[4]= "DANA";
       
        try{
       
         for (int i=0; i<=alumno.length; i++ ){
             System.out.println(alumno[i]);
         }
        }catch (ArrayIndexOutOfBoundsException ex){
        System.out.println("No hay mas elementos en el arreglo");
    }
    }
   

}





No hay comentarios:

Publicar un comentario