60.4k views
1 vote
In a statement: Scanner keyboard = new Scanner (System.in);

it reads user input by means of a Scanner, the user types the line of input below, exactly as shown, including that same spacing.

What is the statement keyboard.nextDouble( ); returned ?

Answer "2": 1+2 is 3 and "5.0" squared is 25.0 !

1 Answer

7 votes

Answer:

A misMatchException is returned.

Explanation: Keyboard.nextDouble(); is expecting a double as an input and the user entered a string first so an error is returned.

User Petr Vostrel
by
4.5k points