I'm trying to understand why inputString
is still empty after executing this
public static void main(String[] args) {
// write your code here
int inputInt = 0;
double inputDouble = 0.0;
String inputString = null;
Scanner scanner3 = new Scanner(System.in);
if (scanner3.hasNext()) {
inputInt = scanner3.nextInt();
}
if (scanner3.hasNext()) {
inputDouble = scanner3.nextDouble();
}
if (scanner3.hasNext()) {
inputString = scanner3.nextLine();
} else {
throw new RuntimeException("No entries left");
}
System.out.println("String: " + inputString);
System.out.println("Double: " + inputDouble);
System.out.println("Int: " + inputInt);
}