|
Operator
|
Description
|
Example
|
|
== (equal to)
|
Checks if the values of two operands are equal or
not, if yes then condition becomes true.
|
(A == B) is not true.
|
|
!= (not equal to)
|
Checks if the values of two operands are equal or
not, if values are not equal then condition becomes true.
|
(A != B) is true.
|
|
> (greater than)
|
Checks if the value of left operand is greater
than the value of right operand, if yes then condition becomes true.
|
(A > B) is not true.
|
|
< (less than)
|
Checks if the value of left operand is less than
the value of right operand, if yes then condition becomes true.
|
(A < B) is true.
|
|
>= (greater than or
equal to)
|
Checks if the value of left operand is greater
than or equal to the value of right operand, if yes then condition becomes
true.
|
(A >= B) is not true.
|
|
<= (less than or equal
to)
|
Checks if the value of left operand is less than
or equal to the value of right operand, if yes then condition becomes true.
|
(A <= B) is true.
|
|
&& (logical and)
|
Called Logical AND operator. If both the operands
are non-zero, then the condition becomes true.
|
(A && B) is false
|
|
|| (logical or)
|
Called Logical OR Operator. If any of the two
operands are non-zero, then the condition becomes true.
|
(A || B) is true
|
|
! (logical not)
|
Called Logical NOT Operator. Use to reverses the
logical state of its operand. If a condition is true then Logical NOT
operator will make false.
|
!(A && B) is true
|
whaust
2019年12月29日 星期日
Java Boolean Operator
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言