I get an error when i try to input name and num in a loop,
int i = 1;
while(i <3) {
System.out.print("Please enter name: ");
String name = input.nextLine();
System.out.print("Please enter number: ");
int num = input.nextInt();
i++;
}
The error that i am getting is this
on the first iteration the input is normal, however on the second iteration it prints the enter num and name at the same line. Could anyone explain to me why is this happening?