## Relational Operators in Java

Relational Operators in Java are those that give information regarding the relation/comparison between two entities/operands. The relation is if they are equal, or greater than other, less than other, etc. Since these operators compare the given operands, they are also called Comparison Operators.

In Java, Relational Operators return boolean value.

Java supports following Relational Operators.

• Equal to
• Not equal to
• Greater than
• Less than
• Greater than or equal to
• Less than or equal to

### Example

In the following program, we take two integer values in `a` and `b`, and demonstrate each of the Relational Operators by competing the values in `a` and `b`.

Main.java

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

Output

```a == b  : 12==10 : false
a != b  : 12!=10 : true
a > b   :  12>10 : true
a < b   :  12<10 : false
a >=b   : 12>=10 : true
a <= b  : 12<=10 : false```

### Java Relational Operator Tutorials

The following tutorials provide a well detailed explanation and examples for each of the Relational Operators in Java.

### Conclusion

In this Java Tutorial, we learned about different Relational Operators in Java Programming with examples.