javacodex.com
Java Examples
Java Examples
memu home questions

Equality and Relational Operators

This java program example demonstrates the use of the equality and relational operators.

Source: (RelationalOperators.java)

public class RelationalOperators {
   public static void main(String[] args) {
      boolean a = 10 > 1;
      boolean b = 10 < 1;
      boolean c = 10 >= 1;
      boolean d = 10 <= 1;
      boolean e = 10 == 1;
 
      System.out.println("a : " + a );
      System.out.println("b : " + b );
      System.out.println("c : " + c );
      System.out.println("d : " + d );
      System.out.println("e : " + d );
   }
}
 

Output:

# java RelationalOperators 
a : true
b : false
c : true
d : false
e : false

Contact: javacodex@yahoo.com