Boolean Logical Operators
The Boolean logical operators are used when we want to form compound conditions by combining two or more relations.
The following table shows the effect of each logical operation :
Program
Program Source
class Javaapp { public static void main(String[] args) { boolean a = true; boolean b = false; boolean c = a | b; boolean d = a & b; boolean e = a ^ b; boolean f = !a; System.out.println("c = "+c); System.out.println("d = "+d); System.out.println("e = "+e); System.out.println("f = "+f); } }