Let's say the user can input different values of different types. However, the program hasn't been completed yet. Fill the blanks, so that the result for each input matches the type of the variable.
Reading user input with Scanner
Different types
Report a typo
Fill in the gaps with the relevant elements
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String word = ;
String line = ;
int intValue = ;
double doubleValue = ;
boolean booleanValue = ;
System.out.println("Word: " + word);
System.out.println("Line: " + line);
System.out.println("Integer Value: " + intValue);
System.out.println("Double Value: " + doubleValue);
System.out.println("Boolean Value: " + booleanValue);
}
}Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.