Java OCA OCP Practice Question 563

Question

What is 7 % -4?

  • A. -3
  • B. 3
  • C. -4
  • D. 4


B.

Note

When doing modulo arithmetic with a negative right-hand operand, the result is the same as it would be if the right-hand operand were positive.

So 7 % -4 is the same as 7 % 4.




PreviousNext

Related