1.
Unit 1 Output:
-
Practice 3.D: Explain why a code segment will not compile or work as intended.
-
LO 1.3.A: Develop code to generate output and determine the result that would be displayed
Consider the following code segment.
System.out.print(Take all the courses in your curriculum.);
System.out.println(Ask questions.);
System.out.println(--Katherine Johnson);
The code segment is intended to produce the following output but does not work as intended.
Take all the courses in your curriculum. Ask questions.
--Katherine Johnson
Which changes should be made so that the code segment produces the intended output?
I. In line 1, print should be changed to println.
II. In lines 1, 2, and 3, print should be capitalized.
III. In lines 1, 2, and 3, the text inside the parentheses should be in quotation marks.
- I only
- print is correct since a new line is not printed after the first line of output.
- II only
- Only class names like System are capitalized.
- III only
- Correct.
- I and II
- I and II are not correct.
- I and III
- print is correct since a new line is not printed after the first line of output.