Java - Greater Than or Equal to Operator >=

What is Greater Than or Equal to Operator

The greater than or equal to operator >= has the following form

operand1 >= operand2 
  

The greater than or equal to operator returns true if the value of operand1 is greater than or equal to the value of operand2. Otherwise, it returns false.

The greater than or equal to operator can be used only with primitive numeric data types.

If either of the operands is NaN (float or double), the greater than or equal to operator returns false.

Example

int i = 10; 
int j = 10; 
boolean b; 
b = (i >= j);  // Assigns true to b 
b = (j >= i);  // Assigns true to b 

Demo

public class Main {
  public static void main(String[] args) {
    int i = 10; /*from   w  w w  .ja  va  2s . co  m*/
    int j = 10; 
    boolean b; 
    b = (i >= j);  // Assigns true to b
    System.out.println(b);
    b = (j >= i);  // Assigns true to b 
    System.out.println(b);
  }
}

Result