Suppose you enter 34.3 57.8 789, then press the ENTER key. Analyze the following code.
Scanner input = new Scanner(System.in);
int v1 = input.nextInt();
int v2 = input.nextInt();
String line = input.nextLine();

a. After the last statement is executed, v1 is 34.
b. The program has a runtime error because 34.3 is not an integer.
c. After the last statement is executed, line contains characters '7', '8', '9', '\n'.
d. After the last statement is executed, line contains characters '7', '8', '9'.

b See discussions in Section 12.11.3.

Computer Science & Information Technology

You might also like to view...

In a queue implementation that uses an array of fixed size,

A) the array must be made so large that the queue will never run out of space B) it is necessary to use the array as a circular buffer C) the array must be created from an ArrayList object D) the queue must implement the List interface

Computer Science & Information Technology

Describe the ways in which the request-reply protocol masks the heterogeneity of operating systems and of computer networks.

What will be an ideal response?

Computer Science & Information Technology