Boolean.logicalAnd(): This method is available in the java.lang.Boolean class of Java.
Syntax:
boolean java.lang.Boolean.logicalAnd(boolean a, boolean b)
This method takes two arguments of type boolean as its parameters. This method returns the result of applying the logical AND operator to the specified boolean operands.
Parameters: Two parameters are required for this method.
a: the first operand.
b: the second operand.
Returns: the logical AND of a and b.
For Example:
Boolean.logicalAnd(true,true) = > It returns true.
Approach
Java
public class BooleanlogicalAnd {public static void main(String[] args) {boolean a = true, b = true;System.out.println(Boolean.logicalAnd(a, b));}}
Output:
true
No comments:
Post a Comment