Web | This Site

Java Basics
Java Object Oriented
Java Advanced
Java Useful References
Java Useful Resources
Selected Reading
© 2011 TutorialsPoint.COM

| Home |  | References |  | Discussion Forums |  | About TP

# Java Relational Operators Example

The following simple example program demonstrates the relational operators. Copy and paste following Java program in Test.java file and compile and run this program. :

    class Test {
    public static void main(String args[]) {
       int a = 10;
       int b = 20;
       System.out.println("a == b = " + (a == b) );
       System.out.println("a != b = " + (a != b) );
       System.out.println("a > b = " + (a > b) );
       System.out.println("a < b = " + (a < b) );
       System.out.println("b >= a = " + (b >= a) );
       System.out.println("b <= a = " + (b <= a) );
    }
    }

This would produce following result:

    a == b = false
    a != b = true
    a > b = false
    a < b = true
    b >= a = true
    b <= a = false

Advertisement

Online Image Processing

Indian Baby Names