Andrew4d313 de Febrero del 2006
PreguntaEstoy tratando de que corra este ciclo
while(lin!=null){
do{
String hab=lin;
lin = archivoEntrada.readLine();
String sem= bla[0];
int sems=Integer.parseInt(sem);
String ced= bla[1];
int ceds= Integer.parseInt(ced);
String p=hab.substring(0,1); String h=hab.substring(1,2);
int pi=Integer.parseInt(p); int ha=Integer.parseInt(h);
if(pi==1){
habsem[ha-1][sems-1]=ceds;}
else if(pi==2){
habsem[ha+3][sems-1]=ceds;}
else if(pi==3){
habsem[ha+7][sems-1]=ceds;}
else if(pi==4){
habsem[ha+11][sems-1]=ceds;}
else if(pi==5){
habsem[ha+15][sems-1]=ceds;}
else{System.out.println(\"\");}
lin = archivoEntrada.readLine();
cant=lin.length();
}while( cant>=3 );
}
archivoEntrada.close();
Todas las Variables estan declaradas perfectamente y el jdk me copila sin ningun problema.
Pero cuando Corro el programa no se Porke aparce un error que dice
Execption in thread \"main\" java.lang.ArrayIndexOutBoundsException: 1 at pruebita.main<pruebita.java>
while(lin!=null){
do{
String hab=lin;
lin = archivoEntrada.readLine();
String sem= bla[0];
int sems=Integer.parseInt(sem);
String ced= bla[1];
int ceds= Integer.parseInt(ced);
String p=hab.substring(0,1); String h=hab.substring(1,2);
int pi=Integer.parseInt(p); int ha=Integer.parseInt(h);
if(pi==1){
habsem[ha-1][sems-1]=ceds;}
else if(pi==2){
habsem[ha+3][sems-1]=ceds;}
else if(pi==3){
habsem[ha+7][sems-1]=ceds;}
else if(pi==4){
habsem[ha+11][sems-1]=ceds;}
else if(pi==5){
habsem[ha+15][sems-1]=ceds;}
else{System.out.println(\"\");}
lin = archivoEntrada.readLine();
cant=lin.length();
}while( cant>=3 );
}
archivoEntrada.close();
Todas las Variables estan declaradas perfectamente y el jdk me copila sin ningun problema.
Pero cuando Corro el programa no se Porke aparce un error que dice
Execption in thread \"main\" java.lang.ArrayIndexOutBoundsException: 1 at pruebita.main<pruebita.java>
