Print Equality Check
This program prints the result of an equality check.
Problem Statement
Write a Java program that checks if two numbers are equal and prints the result.
Source Code
| 1 | public class EqualityCheck { |
| 2 | public static void main(String[] args) { |
| 3 | int a = 10, b = 20; |
| 4 | boolean result = (a == b); |
| 5 | System.out.println("Are a and b equal? " + result + " - Eduinq"); |
| 6 | } |
| 7 | } |
Program Output
Are a and b equal? false - Eduinq
Explanation
int a = 10, b = 20; Declares two integers. (a == b) Checks equality. Prints result. Conclusion: Shows how equality operator works with integers.