Biology Forums - Study Force

Science-Related Homework Help Computer Studies Topic started by: Izzy122 on May 5, 2020



Title: Suppose you enter 34.3, the ENTER key, 57.8, the ENTER key, abc, the Enter key. Analyze the ...
Post by: Izzy122 on May 5, 2020
Suppose you enter 34.3, the ENTER key, 57.8, the ENTER key, abc, the Enter key. Analyze the following code.

1 Scanner input = new Scanner(System.in);
2 double v1 = input.nextDouble();
3 double v2 = input.nextDouble();
4 String line = input.nextLine();


▸ After line 4 is executed, line contains an empty string.

▸ After line 2 is executed, v1 is 34.3.

▸ After line 4 is executed, line contains character "abc".

▸ After line 3 is executed, v2 is 57.8.

▸ After line 4 is executed, line is null.


Title: Suppose you enter 34.3, the ENTER key, 57.8, the ENTER key, abc, the Enter key. Analyze the ...
Post by: n00835996 on May 5, 2020
Content hidden