0
0
Javaprogramming~5 mins

Output using System.out.print in Java - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does System.out.print do in Java?

System.out.print prints text or values to the console without moving to a new line afterwards.

Click to reveal answer
beginner
How is System.out.print different from System.out.println?

System.out.print prints text and stays on the same line, while System.out.println prints text and moves to the next line.

Click to reveal answer
beginner
Write a Java statement to print the word Hello without moving to a new line.
System.out.print("Hello");
Click to reveal answer
beginner
What will be the output of this code?<br>
System.out.print("Hi");
System.out.print(" there");

The output will be Hi there on the same line because System.out.print does not add a new line.

Click to reveal answer
beginner
Can System.out.print print numbers as well as text?

Yes, it can print numbers, text, or any data type by converting them to string form.

Click to reveal answer
What does System.out.print("Hello"); do?
APrints Hello without moving to a new line
BPrints Hello and moves to a new line
CPrints nothing
DCauses an error
Which statement prints text and moves to the next line?
ASystem.out.printline()
BSystem.out.print()
CSystem.out.write()
DSystem.out.println()
What will be the output of:<br>System.out.print("A"); System.out.print("B");
AA B
BA B
CAB
DB A
Can System.out.print print numbers directly?
ANo, only text
BYes, numbers are converted to text automatically
COnly if converted manually
DOnly integers, not decimals
What happens if you use System.out.print multiple times in a row?
AOutputs appear one after another on the same line
BOutputs overwrite each other
COnly the last output shows
DEach output appears on a new line
Explain how System.out.print works and how it differs from System.out.println.
Think about what happens after printing.
You got /3 concepts.
    Write a short Java code snippet using System.out.print to print two words on the same line.
    Use two print calls without println.
    You got /3 concepts.