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 is initialized with the string 'hello 1 2.00 false' and uses space as delimiter. scanner.next() returns 'hello', scanner.nextInt() returns 1, scanner.nextFloat() returns 2.0 (note: when printed, float 2.00 displays as 2.0), and scanner.nextBoolean() returns false. These are concatenated with colons, producing 'hello:1:2.0:false'. No InputMismatchException occurs because the data types match the scanner method calls.