Read Java Interview Questions and Answers for Beginners and Experienced

Java greater than equal to operator Example

In this post, we will study about Java greater than equal to Operator Example. How greater than equal to operator works with example.

 


Java greater than equal to Operator

Greater than equal to is one of the Java comparison operators. It is used to evaluate and check the greater value between two variables. it is almost equal to Java greater than operator.

 


Syntax of Java greater than equal to operator

Below is the syntax of Java greater than equal to Operator.

X >=Y
  • Here X and Y are two variables.
  • >= is the greater than equal to operator which evaluates whether X is greater than or equal to Y.

Greater than equal to operator is almost works same as greater than equal to operator in Java. Only difference is that greater than equals to operator compares the equal value also, it means it will return true, if  X is greater than and equals to Y.

 


Java greater than equal to Operator Example

Let’s understand Java greater than equal to operator with example.

public class JavaExamples {

public static void main(String[] args) {
//Java greater than equal to Operator Example in Java
int a=10;
int b=20;
int c=10;

System.out.println(a >=b);
System.out.println(b >=c);
System.out.println(c >=a);

}

}

Output

false
true
true

Explanation

In above Java greater than equal to Operator Example, There are three variable a, b, c. We apply >= operator on a, b and c.

 


Java greater than equal to operator is used when we have to check left hand side variable is greater than or equals to Right hand variable.