public class LogicalOperators {
public static void main(String args[]) {
// Logical operators &, |;
boolean a = true;
boolean b = false;
// All these operators will return either true or false
// &(and operator) i.e result will be true if both input are true
System.out.println("And operator Result");
System.out.println(a & b); // false as b is false;
System.out.println(b & a); // false as b is false;
System.out.println(b & b); // false as b is false;
System.out.println(a & a); // true as a is true;
// |(Pipe operator) i.e or operator;
result will be true if either input is true
System.out.println("Pipe operator Result");
System.out.println(a | b);
System.out.println(b | a);
System.out.println(b | b);
System.out.println(a | a);
}
}