Multiple choice technology architecture

import java.util.Scanner; public class ScannerTest { public static void main(String[] args) { Scanner scanner = new Scanner("hello 1 2.00 false"); scanner.useDelimiter(" "); String str = scanner.next(); int anInt = scanner.nextInt(); float aFloat = scanner.nextFloat(); boolean booleanValue = scanner.nextBoolean(); System.out.println(str + ":" + anInt + ":" + aFloat + ":" + booleanValue); } } What is the output?

  1. The program will output 'hello:1:2.0:false'

  2. The program will throw Input Mismatch exception at the run-time

  3. The program will output nothing.

  4. The program will ouput ':1:2.0:false'

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The Scanner with space delimiter correctly parses: scanner.next() returns 'hello', scanner.nextInt() parses '1', scanner.nextFloat() parses '2.00' as 2.0, scanner.nextBoolean() parses 'false'. The output concatenates these: 'hello:1:2.0:false'. No InputMismatchException occurs because the tokens match the expected types.