Print Logical OR Result
This program prints the result of a logical OR operation.
Problem Statement
Write a Java program that evaluates a logical OR expression and prints the result.
Source Code
| 1 | public class LogicalOr { |
| 2 | public static void main(String[] args) { |
| 3 | boolean result = (5 > 10) || (10 > 3); |
| 4 | System.out.println("Result of OR: " + result + " - Eduinq"); |
| 5 | } |
| 6 | } |
Program Output
Result of OR: true - Eduinq
Explanation
The condition (5 > 10) evaluates to false while (10 > 3) evaluates to true, and the logical OR (||) operator returns true because at least one condition is true, demonstrating how OR returns true if any one condition holds.