CKTIS / Java
Greater-than-or-equal operator (>=)
The >= operator compares numeric values and returns boolean. It includes equality, making it useful for checking thresholds that include the boundary value.
Version: Java SE 21; repository runtime, production runtime not attested
Syntax
left >= rightleft >= right checks whether the left value is greater than or equal to the right; the result has type boolean. Unlike >, it includes equality.
Operands must be numeric or unboxable to numeric types. Binary numeric promotion applies; conversion to float or double can lose precision. Unboxing null throws NullPointerException. The operator does not compare String objects or boolean values.
If either operand is NaN, the result is false. Positive and negative zero are equal. Thus, a >= b is not always equivalent to !(a < b).
Do not chain comparisons as a >= b >= c: the first result is boolean. Write a >= b && b >= c.
Examples
public class Main {
public static void main(String[] args) {
int score = 60;
int minimum = 60;
System.out.println(score >= minimum);
System.out.println(59 >= minimum);
System.out.println(Double.NaN >= minimum);
}
}Result
true false false
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.