char c = 'X';
int n = c + c;
System.out.println(n);What is printed?
- A
88
- B
XX
- Ccheck_circle
176
- D
Error
Explanation
Without a string operand, char + char promotes to int arithmetic; 'X' is 88, so 88 + 88 = 176.
AP Computer Science A· difficulty 4/5
char c = 'X';
int n = c + c;
System.out.println(n);What is printed?
88
XX
176
Error
Explanation
Without a string operand, char + char promotes to int arithmetic; 'X' is 88, so 88 + 88 = 176.
Want 10 more like this — adaptive to your weak spots?