Java OCA OCP Practice Question 566

Question

Which of the following Java operators can be used with boolean variables?

Choose all that apply

  • A. ==
  • B. +
  • C. --
  • D. !
  • E. %
  • F. <=


A, D.

Note

Option A is the equality operator and can be used on numeric primitives, boolean values, and object references.

Options B and C are both arithmetic operators and cannot be applied to a boolean value.

Option D is the logical complement operator and is used exclusively with boolean values.

Option E is the modulus operator, which can only be used with numeric primitives.

Option F is a relational operator that compares the values of two numbers.




PreviousNext

Related