Print Logical AND Result
This program prints the result of a logical AND operation.
Problem Statement
Write a Java program that evaluates a logical AND expression.
Source Code
| 1 | public class LogicalAnd { |
| 2 | public static void main(String[] args) { |
| 3 | boolean result = (5 > 2) && (10 > 3); |
| 4 | System.out.println("Result of AND: " + result + " - Eduinq"); |
| 5 | } |
| 6 | } |
Program Output
Result of AND: true - Eduinq
Explanation
Both conditions (5 > 2) and (10 > 3) evaluate to true, so the logical AND (&&) operator returns true, which is printed with descriptive text, showing usage of the logical AND operator.