← Back to Printing
Question 16
Multiple Prints Same Line
Multiple Prints Same Line
UseSystem.out.print()for the first two words andSystem.out.println()for the last word, so all three words appear on one line (see Expected Output). First statement:System.out.print("I ")Second statement:System.out.print("love ")Third statement:System.out.println("coding!")print()does not move to the next line, which is why the words stay together.println()prints the last word and then ends the line with a newline. Make sure to include the spaces so the words don't run together.
Expected Output:
I love coding!= newline. The output ends with a newline — print one after the last line.
Hints3 available
Sign in to use hintsTopics:
Printing
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (sysout, psvm, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.