Online Java Compiler By
JavaTpoint.com
public class BooleanLogicalAndExample1 { public static void main(String[] args) { Boolean b1 = true; Boolean b2 = true; // when bool values are true logicalAnd() method returns true Boolean b3 = Boolean.logicalAnd(b1,b2); System.out.println("1. logicalAnd() method for "+b1+" "+b2+" is "+b3); Boolean b4 = true; Boolean b5 = false; // if either of the bool value if false logicalAnd() method returns false. Boolean b6 = Boolean.logicalAnd(b4,b5); System.out.println("2. logicalAnd() method for "+b4+" "+b5+" is "+b6); } }
Output