← Quiz: Java Introduction: all 10 questions
Quiz: Java Introduction · Question 2 of 10
What does this print? (code)
What does this print?
public class Main {
public static void main(String[] args) {
System.out.println("A" + 1 + 2);
}
}
- A.A3
- B.A12
- C.3A
- D.Error
Answer & explanation
Correct answer: A12
"A" + 1 gives "A1", then + 2 gives "A12". Text joining happens left to right.
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 →