Print Result of Boolean Expression
This program prints the result of a boolean expression.
Problem Statement
Write a Java program that evaluates a boolean expression and prints the result.
Source Code
| 1 | public class BooleanExpression { |
| 2 | public static void main(String[] args) { |
| 3 | boolean result = (10 > 5); |
| 4 | System.out.println("Is 10 greater than 5? " + result + " - Eduinq"); |
| 5 | } |
| 6 | } |
Program Output
Is 10 greater than 5? true - Eduinq
Explanation
boolean result = (10 > 5); Evaluates the expression and stores true. Prints the result with Eduinq branding. Conclusion: Shows how boolean expressions can be evaluated and printed.