== equal to != not equal to > greater than >= greater than or equal to < less than <= less than or equal to
public class ComparisonDemo { public static void main (String[] args) { int x = 3; int y = 5; if (x==y) System.out.println("equal to"); if (x!=y) System.out.println("not equal to"); if (x>y) System.out.println("greater than"); if (x>=y) System.out.println("greater than or equal to"); if (x<=y) System.out.println("less than or equal to"); } } |
Out put
not equal to
less than
less than or equal to