Boolean expressions are like simple “yes or no” questions that a computer can answer. When you compare two values (e.g., Is 5 greater than 3?), the result is always either true or false. This true-or-false logic is how your computer decides which instructions to execute next: if the condition is true, it follows one path; if it’s false, it follows another. There are quite a few symbols that can be used to form boolean expressions. The first one is the == (equal-to) operator, which tests whether the expression on the left is equal to the expression on the right.
int x = 5;
int y = 5;
boolean isEqual = (x == y);
System.out.println(isEqual);
int a = 5;
int b = 10;
System.out.println(x == y);
int a = 7;
int b = 7;
System.out.println(a == b);Output
true false true