Mastering Java: The Ultimate Quiz for 'Thinking in Java'

Disable ads (and more) with a membership for a one time $2.99 payment

Mastering Java: The Ultimate Quiz for 'Thinking in Java'. Dive deep into Java with multiple-choice questions. Challenge yourself with quiz questions designed to test and improve your understanding of the 'Thinking in Java' book. Get ready for your exam!

Practice this question and more.


What does the modulus operator (%) in Java return?

  1. A quotient

  2. A remainder of division

  3. A float result

  4. A boolean result

The correct answer is: A remainder of division

The modulus operator (%) in Java returns the remainder of division between two numbers. This is different from the quotient (result of division) or a float result. Additionally, the modulus operator does not return a boolean (true or false) result. Therefore, A, C, and D are incorrect options.