1
Scanner scan = new Scanner(System.in);

System.out.print("int: ");
int i = scan.nextInt();
System.out.print("db: ");
double d = scan.nextDouble();
System.out.println("st: ");
String s =  scan.nextLine();
System.out.println("String: " + s);
System.out.println("Double: " + d);
System.out.println("Int: " + i);

my string input is not being read and its directly printing the int value. But when I put the input line of the string before the int, then it is being read

VietHTran
  • 2,167
  • 2
  • 7
  • 16

0 Answers0