Suppose you enter 34.3, the ENTER key, 57.8, 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();
```
a. After line 2 is executed, v1 is 34.3.
b. After line 3 is executed, v2 is 57.8.
c. After line 4 is executed, line contains an empty string.
d. After line 4 is executed, line is null.
e. After line 4 is executed, line contains character "\n".

abc See discussions in Section 12.11.3.

Computer Science & Information Technology

You might also like to view...

Which statement correctly opens an input stream named in_file and attaches it to a file name project.txt?

a. in_file=project.txt b. in_file="project.txt" c. in_file.open("project.txt"); d. in_file.open(project.txt);

Computer Science & Information Technology

When must a program explicitly use the this reference?

a. Accessing a private variable. b. Accessing a public variable. c. Accessing a local variable. d. Accessing an instance variable that is shadowed by a local variable.

Computer Science & Information Technology