Javatpoint Logo
Javatpoint Logo

Java Boolean logicalXor() Method

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

Syntax:

Parameters:

The parameters passed are a (first Boolean operand) and b (second Boolean operand).

Return Value:

The logicalXor() method returns the result of applying logical XOR operation on Boolean parameters a and b.

  • It returns true, if both the Boolean operand passed are different.
  • It returns false, if both the Boolean operand passed are same.

Example 1

Test it Now

Output:

1. logicalXor() method for true false is true
2. logicalXor() method for true true is false
3. logicalXor() method for false false is false

Example 2

Output:

Enter your age
45
logical Xor is true 
You are an adult.
You are eligible to vote.

Example 3

Output:

Enter two no.s
I no : 45
II no : 89
89 is greater

Next TopicJava Boolean





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA