int a = 5;
int b = a++;Which set of statements gives the same final values of a and b?
- Acheck_circle
int a = 5; int b = a; a = a + 1;
- B
int a = 5; a = a + 1; int b = a;
- C
int a = 5; int b = a + 1;
- D
int a = 6; int b = 6;
Explanation
Postfix a++ assigns the original value (5) to b first, then increments a to 6. Option A reproduces this exactly.