Online Java Compiler By
JavaTpoint.com
public class BooleanLogicalXorExample1 { public static void main(String[] args) { Boolean b1 = true; Boolean b2 = false; //if the bool values are different logicalXor() method will return true. Boolean b3 = Boolean.logicalXor(b1, b2); System.out.println("1. logicalXor() method for "+b1+" "+b2+" is "+b3); Boolean b4 = true; Boolean b5 = true; //if the bool value are same logicalXor() method will return false. Boolean b6 = Boolean.logicalXor(b4, b5); System.out.println("2. logicalXor() method for "+b4+" "+b5+" is "+b6); Boolean b7 = false; Boolean b8 = false; System.out.println("3. logicalXor() method for "+b7+" "+b8+" is "+Boolean.logicalXor(b7,b8)); } }
Output