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?✗ Incorrect
System.out.print prints text but stays on the same line.
Which statement prints text and moves to the next line?
✗ Incorrect
System.out.println() prints text and then moves to a new line.
What will be the output of:<br>
System.out.print("A"); System.out.print("B");✗ Incorrect
Both prints stay on the same line, so output is AB.
Can
System.out.print print numbers directly?✗ Incorrect
Java converts numbers to text automatically when printing.
What happens if you use
System.out.print multiple times in a row?✗ Incorrect
Multiple System.out.print calls print outputs continuously on the same 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.