I have in my code several System.out.println () asking certain things and picking up in their corresponding variable what the user enters through the keyboard. The fact is that after several System.out.println (), Eclipse is as if you ignored the last one and will not let you enter anything by keyboard because it has advanced with the program. I have checked the code again and again for errors but nothing. Could it be a limitation of Eclipse? What do you think?
Thank you very much and greetings.
PS: the piece of code is inside main
Scanner sc = new Scanner(System.in);
String DNI = null;
while((DNI == null) || (DNI.equals("")) || DNI.length()<6){
System.out.println("El DNI es obligatorio para la creacion "
+ "de un alumno.");
System.out.println("Introduce el DNI: ");
DNI = sc.nextLine();
if(DNI!=null && DNI.length()<6){
System.out.println("El DNI introducido es demasiado corto.");
}
}
System.out.println("Introduce la direccion: ");
String direccion = sc.nextLine();
System.out.println("Introduce el nombre: ");
String nombre = sc.nextLine();
System.out.println("Introduce tu fecha de nacimiento "
+ "(AAAA-MM-DD): ");
String edad = sc.nextLine();
System.out.println("Introduce el telefono: ");
int telefono = sc.nextInt();
System.out.println("Introduce el cif de empresa: ");
String CIFEmpresa = sc.nextLine();