String s = "Sum: " + (2 + 3);
System.out.println(s);What is printed?
- Acheck_circle
Sum: 5
- B
Sum: 23
- C
Sum: 2+3
- D
Sum: 2 3
Explanation
Parentheses force 2 + 3 to be evaluated as integer addition first, giving 5, then concatenated to "Sum: ".
AP Computer Science A· difficulty 4/5
String s = "Sum: " + (2 + 3);
System.out.println(s);What is printed?
Sum: 5
Sum: 23
Sum: 2+3
Sum: 2 3
Explanation
Parentheses force 2 + 3 to be evaluated as integer addition first, giving 5, then concatenated to "Sum: ".
Want 10 more like this — adaptive to your weak spots?