Example


\begin{lstlisting}
class RelationalOperator {
public static void main(String[] ...
...stem.out.println(''number2 is greater than number1.'');
}
}
}
\end{lstlisting}

The output for the above code will be number2 is greater than number1. Here, we have used > operator to check if number1 is greater than number2 or not. Since number2 is greater than number1, the expression number1 > number2 is evaluated to false. Hence, the block of code inside else is executed and the block of code inside if is skipped. If you didn't understand the above code, don't worry. You will learn it in detail in Java if...else section. For now, just remember that the equality and relational operators compare two operands and is evaluated to either true or false.