2
I have the following code:
public class FlagApplication {
private Scanner keyboard;
....
private void insertNewRegistry(){
System.out.println("insira os dados de pessoa: nome, peso, altura, idade, sexo e bi.");
String nome = keyboard.nextLine();
System.out.println("nome: " +nome);
double peso = keyboard.nextDouble();
System.out.println("peso: " +peso);
int altura = keyboard.nextInt();
System.out.println(altura);
int idade = keyboard.nextInt();
System.out.println(idade);
char sexo = keyboard.next(".").charAt(0);
System.out.println(idade);
int bi = keyboard.nextInt();
}
....
}
The problem is that the first input to be assumed is soon the weight, instead of being the name, ie does System.out.println("nome: " +nome);
whose name is empty ('') and waits for the weight instead of waiting first for the name
Is there any way to put the rest of the code? The part where Scanner.
– ptkato
I edited, I think there’s everything that’s relevant
– Miguel