Java Relational Operator Example


  • It is used to compare the value of two operands and return the result in the form of the booleans - True or False.

  • Comparison Operator- <, >, <=, >=, instanceof

  • Equality Operator- ==, !=

Program
public class RelationalOperatorExample{ public static void main(String args[]){ int x=7,y=3; System.out.println(x==y); //false System.out.println(x!=y); //True System.out.println(x<=y); //false System.out.println(x>=y); //true System.out.println(x>y); //true System.out.println(x<y); //false }}
Input
Output