I am running this code to get 3 values: an integer, a string and a boolean from the user and print it in separate lines.
import java.util.*;
public class Practice {
public static void main(String[] args){
int a;
String b;
boolean c;
Scanner scanner = new Scanner(System.in);
a = scanner.nextInt();
b = scanner.nextLine();
c = scanner.nextBoolean();
System.out.println(a);
System.out.println(b);
System.out.println(c);
}
}
I am trying to give input like this:
1
hello world
true
and am getting this error after writing the second line of input