int a = 5, b = 9;
int temp = a;
a = b;
b = temp;What are the values of a and b after?
- Acheck_circle
a=9, b=5
- B
a=5, b=9
- C
a=5, b=5
- D
a=9, b=9
Explanation
The temp variable preserves a's value while it is overwritten by b.
AP Computer Science A· difficulty 1/5
int a = 5, b = 9;
int temp = a;
a = b;
b = temp;What are the values of a and b after?
a=9, b=5
a=5, b=9
a=5, b=5
a=9, b=9
Explanation
The temp variable preserves a's value while it is overwritten by b.
Want 10 more like this — adaptive to your weak spots?