Java Boolean - logicalOr() Method
The java.lang.Boolean.logicalOr() method returns the result of applying the logical OR operator to the specified boolean operands.
Syntax
public static boolean logicalOr(boolean a, boolean b)
Parameters
a |
Specify the first operand. |
b |
Specify the second operand. |
Return Value
Returns the logical OR of a and b.
Exception
NA.
Example:
In the example below, the java.lang.Boolean.logicalOr() method returns the result of applying the logical OR operator to the given boolean operands.
import java.lang.*; public class MyClass { public static void main(String[] args) { //creating boolean values boolean b1 = true; boolean b2 = false; //printing the result of applying OR operator System.out.println("b1 OR b1: " + Boolean.logicalOr(b1, b1)); System.out.println("b2 OR b2: " + Boolean.logicalOr(b2, b2)); System.out.println("b1 OR b2: " + Boolean.logicalOr(b1, b2)); } }
The output of the above code will be:
b1 OR b1: true b2 OR b2: false b1 OR b2: true
❮ Java.lang - Boolean