Relational Operators Examples in Java


Here is the simple program for printing relational operators in Java.

Source Code

/* 
  Tutor Joes Computer Education  
  www.tutorjoes.com
*/ 
import java.io.*;
import java.util.Scanner;
class relation
{
  public static void main(String args[])
  {
  	/*
      < is Less Than
      <= is Less than or Equal To
      >  is Greater Than
      >=  is Greater than or Equal To
      == is equal to
      != is not equal to
  	*/
   int a=100 , b=100;
    System.out.println("Less Than : "+(a<b));
    System.out.println("Greater Than : "+(a>b));
    System.out.println("Equal  : "+(a==b));
    System.out.println("Not Equal  : "+(a!=b));
    System.out.println("Less Than or equal : "+(a<=b));
    System.out.println("Greater Than  or equal: "+(a>=b));
  }
}
To download raw file Click Here

Output

Less Than : false
Greater Than : false
Equal  : true
Not Equal  : false
Less Than or equal : true
Greater Than  or equal: true


Learn All in Tamil © Designed & Developed By Tutor Joes