Sobes.tech
Intern

What logical operations and operators do you know?

sobes.tech AI

Answer from AI

I know the following logical operations and operators in Java:

  • Logical "AND": && (short-circuit) and & (regular).
    • && evaluates the second operand only if the first is true.
    • & always evaluates both operands.
  • Logical "OR": || (short-circuit) and | (regular).
    • || evaluates the second operand only if the first is false.
    • | always evaluates both operands.
  • Logical "NOT": !
    • Inverts the boolean value of the operand.
  • Logical "Exclusive OR" (XOR): ^
    • Returns true if the operands have different boolean values.

Applicable to boolean types and used in conditional expressions and loops.