Java Relational Operators

In this tutorial you will learn about the Java Relational Operators and its application with practical example.

Java Relational Operators

Relational Operators are used evaluate a comparison between two operands. The result of a relational operation is a Boolean value that can only be true or false. Relational Operators are also referred as comparison operators.

Let variable a holds 20 and variable b holds 10, then −

Java Relational operators
Operator Description Example
> greater than a>b returns TRUE
< Less than a<b returns FALSE
>= greater than or equal to a>=b returns TRUE
<= less than or equal to a<=b returns FALSE
== is equal to a==b returns FALSE
!= not equal to a!=b returns TRUE

Example:-

When you run the above java program, you will see the following output.

Output:-

java_relational_operators_example

In this tutorial we have learn about the Java Relational Operators and its application with practical example. I hope you will like this tutorial.