← Quiz: Java Introduction: all 10 questions
Quiz: Java Introduction · Question 6 of 10
What does this print? (code)
What does this print?
public class Main {
public static void main(String[] args) {
System.out.print("Hi ");
System.out.print("there");
System.out.println("!");
}
}
- A.Hi
- B.Hi there
- C.Hi there!
- D.!
Answer & explanation
Correct answer: Hi there!
print does not move to a new line, so all three pieces appear on one line; println ends the line after "!".
Can you get the rest right without peeking?
Take the timed Quiz: Java Introduction quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →