Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to print "Hello" without a newline.
Java
System.out.[1]("Hello");
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using println instead of print, which adds a newline.
Using write which requires different parameters.
✗ Incorrect
The print method prints text without moving to a new line.
2fill in blank
mediumComplete the code to print the number 123 without a newline.
Java
System.out.[1](123);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using println which adds a newline.
Using printf without format string.
✗ Incorrect
print prints the number without moving to a new line.
3fill in blank
hardFix the error in the code to print "Java" without a newline.
Java
System.out.[1]("Java");
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a non-existent method
printline.Confusing
println with print.✗ Incorrect
print is the correct method to print without newline. printline is not a valid method.
4fill in blank
hardFill both blanks to print the sum of 5 and 3 without a newline.
Java
System.out.[1](5 [2] 3);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using println which adds a newline.
Using subtraction instead of addition.
✗ Incorrect
Use print to avoid newline and + to add numbers.
5fill in blank
hardFill both blanks to print the uppercase word "HELLO" without a newline.
Java
System.out.[1]("hello".[2]());
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using println which adds a newline.
Using toLowerCase instead of toUpperCase.
✗ Incorrect
Use print to avoid newline and toUpperCase() to convert text to uppercase.