Different types

Report a typo

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.

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);
  }
}
scanner.next()scanner.nextLine()scanner.nextInt()scanner.next()scanner.nextDouble()scanner.nextBoolean()

Create a free account to access the full topic