Relational Operator In Java
Definition: Relational Operators ? Use of the Relational Operators
The relational operators are binary operators .In java, Relational operators specify the relation between two variables by comparing them. There are 5 relational operators in Java.
Use of the Relational Operators
➦A relational operator tests data values against one another.
➦You can only compare similar data types. (It makes no sense to compare a char to a float.
➦All relational operators return either a 1 (meaning true) or a 0 (false.)
➦You will use the relational operators to test whether a condition is true or false and act accordingly.
|==||Is equal to||a==b|
|!=||Is not equal to||a!=b|
|>=||Greater than or equal to||a>=b|
|<=||Less than or equal to||a<=b|
a == b = false a != b = true a > b = false a < b = true b >= a = true b <= a = false
Please Enter two integer Value: 6 8 a is Not equal to b