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

(5 > 10) Evaluates to false. (10 > 3) Evaluates to true. false || true Logical OR returns true because at least one condition is true. The result is stored in a boolean variable and printed with Eduinq branding. Conclusion: This program demonstrates the logical OR operator. It shows how OR returns true if any one of the conditions is true.

Quick Links to Explore