Ver Mensaje Individual
  #4 (permalink)  
Antiguo 05/11/2014, 01:51
Avatar de Profesor_Falken
Profesor_Falken
 
Fecha de Ingreso: agosto-2014
Ubicación: Mountain View
Mensajes: 1.323
Antigüedad: 9 años, 9 meses
Puntos: 182
Respuesta: error en programita

Buenas,

He cogido tu codigo y he creado un pequeno ejemplo ejecutable a partir de tu codigo para aislar y reproducir el problema:

Código Java:
Ver original
  1. public class ScannerProblem {
  2.  
  3.     static int propiedad;
  4.     static int persona[] = new int[6];
  5.  
  6.     public static void main(String[] args) {
  7.  
  8.         System.out.println(
  9.                 "Ingrese su jugada aqui");
  10.         Scanner dato = new Scanner(System.in);
  11.         // int [] perro={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48};
  12.         propiedad = dato.nextInt();
  13.         if (propiedad
  14.                 > 0 && propiedad
  15.                 < 49) {
  16.             for (int y = 0; y < 6; y++) {
  17.                 persona[y] = dato.nextInt();
  18.             }
  19.         } else {
  20.             System.out.println("Supero el rango permitido");
  21.         }
  22.     }
  23. }

La salida es:

Código Salida Consola:
Ver original
  1. run:
  2. Ingrese su jugada aqui
  3. 12
  4. 15
  5. 12
  6. 12
  7. 13
  8. 14
  9. 15
  10. BUILD SUCCESSFUL (total time: 12 seconds)

Lo cual es correcto. Me pide una vez el valor de "propiedad" y posteriormente me solicita 6 integer antes de salir del bucle.

Cual es entonces el problema??


Un saludo
__________________
If to err is human, then programmers are the most human of us