Understanding Java Comparison Operators: Equal, Greater, Less and More
The result of executing comparison operators is a boolean value. Most often, comparison operators are used in expressions that control the if statement and various loop operators.
It is allowed to compare values of any type using the == and != operators.
Comparison using ordering operations is allowed only for numeric data types.
For example:
int a = 4;
int b = 1;
boolean c = a < b;
The following table contains all existing Java comparison operators:
| Operator | Description |
| == | Equal to |
| != | Not equal to |
| > | Greater than |
| < | Less than |
| >= | Greater than or equal to |
| <= | Less than or equal to |
Курс 'Java для начинающих' на Udemy
Please log in or register to have a possibility to add comment.