import java.util.Scanner;
public class test{
public static void main(String args[]){
String branch;
String Name;
String course;
int Age;
int Roll;
int counter = 1;
int pin;
Scanner s = new Scanner(System.in);
{
System.out.print("Enter your Name : ");
Name = s.nextLine();
System.out.print("Enter your Age : ");
Age = s.nextInt();
System.out.print("Enter your Branch : ");
branch = s.nextLine();
System.out.print("Enter your PIN : ");
pin = s.nextInt();
System.out.print("Enter your Course : ");
course = s.nextLine();
Roll = counter++;
}
}
}
As shown in image, user input for Branch and Course is skipped
This code is for Data Entry. While running this code command Prompt did not asked for user input for Branch and Course which are of type string. Why does this happen?