A relational operator compares two values and determines the relationship between them. For example, !=
returns true
if its two operands are unequal. The next table summarizes the relational operators:
Relational Operators
>
| op1 > op2
| Returns true if op1 is greater than op2
|
>=
| op1 >= op2
| Returns true if op1 is greater than or equal to op2
|
i]]; //true
System.out.println[" k > j = " + [k > j]]; //false;
//they are equal
//greater than or equal to
System.out.println["Greater than or equal to..."];
System.out.println[" i >= j = " + [i >= j]]; //false
System.out.println[" j >= i = " + [j >= i]]; //true
System.out.println[" k >= j = " + [k >= j]]; //true
//less than
System.out.println["Less than..."];
System.out.println[" i < j = " + [i < j]]; //true
System.out.println[" j < i = " + [j < i]]; //false
System.out.println[" k < j = " + [k < j]]; //false
//less than or equal to
System.out.println["Less than or equal to..."];
System.out.println[" i
Chủ Đề |