Java Boolean logicalAnd() Method

The logicalAnd() method of Java Boolean class returns the result of implementing logical AND operation on the assigned Boolean operands.

Syntax:

Parameters:

The parameters passed are a ( first Boolean operand) and b (second Boolean operand).

Return Value:

The logicalAnd() method returns the result of applying logical AND operation on Boolean parameters a and b.

Example 1

Test it Now

Output:

1. logicalAnd() method for true true is true
2. logicalAnd() method for true false is false

Example 2

Output:

Enter your percentage.
63
Sorry! You have failed. You needed 1.0 more marks to pass.
Try again next year.

Example 3

Output:

Enter two number.
0
0
Divide = 0/0
Division is not possible.

Next TopicJava Boolean




Latest Courses