In this java article, we will be covering XOR logical operator in Java. XOR logical operator means one of conditions either both TRUE or both FALSE. In other word, one condition should not be different than other as result.
Lets look to syntax of it in Java.
int x = 1;
int y= 5;
if(x < y x == 1) //??? ??????
{
System.out.println("x > y OR x = 1");
}
else
{
System.out.println("else..");
}
Lets see it in Java code example.
In above example, we declared two variable and used "" operator as XOR operation. If block executes if both condition is TRUE or FALSE. To test it, we printed result with IF and ELSE blocks. In our example, x was 1 and it "y" was greater than "x" and caused XOR condition to evaluate TRUE.