The logicalXor() method of Java Boolean class returns the result of implementing logical XOR operation on the specified Boolean operands.

Syntax:

public static boolean logicalXor (boolean a, boolean b)

Parameters:

The parameters ‘a’ and ‘b’ represents first and second operands.

Return Value:

The logicalXor () method returns the result after implementing logical AND operation on the parameters ‘a’ and ‘b’.

  • It returns true, if the parameters ‘a’ and ‘b’ are different.
  • It returns false, if both the parameters are identical.

Example 1:

Output:

Example 2:

Output:

Example 3:

Output:

Pin It on Pinterest

Share This