In Java, <code>-7 % 3</code> evaluates to
- A
2
- Bcheck_circle
−1
- C
1
- D
−2
Explanation
Java's <code>%</code> follows the sign of the dividend: −7 = 3·(−2) + (−1), so result is −1.
AP Computer Science A· difficulty 4/5
In Java, <code>-7 % 3</code> evaluates to
2
−1
1
−2
Explanation
Java's <code>%</code> follows the sign of the dividend: −7 = 3·(−2) + (−1), so result is −1.
Want 10 more like this — adaptive to your weak spots?