Multiple choice technology programming languages

What output will the following line produce? System.out.println("The answer is: "+17+3);

  1. 20

  2. 17+3

  3. 173

  4. CompileTime Error

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

When a string is concatenated with integers using the + operator, Java evaluates left-to-right. First "The answer is: " + 17 produces "The answer is: 17". Then that string is concatenated with 3 to produce "The answer is: 173". Once a string enters the expression, all subsequent + operations perform string concatenation, not arithmetic addition.