Equal to or greater than java – Java Program on Greater Than or Equal To Operator

Equal to or greater than java: In the previous article, we have discussed about Java Program on Greater Than and Less Than Operator

In this article we will see the use of Greater Than or Equal To operator in Java programming language.

Java Program on Greater Than or Equal To Operator

Greater Than or Equal To Operator:

Greater Than or Equal To operator is a relational operator which is used for comparison purpose. It checks if the value of left hand operand is greater than or equal to the value of right hand operand.

Syntax: operand1 >= operand2

Let’s see an program to understand the use of operator more clearly.

import java.util.Scanner;

class Main
{
    public static void main(String[] args)
    {
        //Scanner class object created
        Scanner in=new Scanner(System.in);
        //Taking input of 2 numbers
        System.out.println("Enter any two numbers: ");
        int n1=in.nextInt();
        int n2=in.nextInt();
        //checking if first value is greater than or equal to second value
        if(n1>=n2)
        {
        	System.out.println(n1+" is greater than or equal to "+ n2+ " : True");
        }
        else
        {
          	System.out.println(n1+" is greater than or equal to "+ n2+ " : False");  
        }

    }
}
Output:

Case-1
Enter any two numbers: 
564
564
564 is greater than or equal to 564 : True

Case-2
Enter any two numbers: 
564
77
564 is greater than or equal to 77 : True

Case-3
Enter any two numbers: 
564
999
564 is greater than or equal to 999 : False

Don’t miss the chance of Java programs examples with output pdf free download as it is very essential for all beginners to experienced programmers for cracking the interviews.

Related Java Programs: