Not always are robins not seen when the weather is not fair.
Sometimes robins are seen when the weather is not fair.
Robins are sometimes seen in poor weather.
It is useful to have some rules for rewriting boolean expressions. Here is an easy one:
!!A
is equivalent to A
The operand A stands for a true/false value or an expression that results in a true/false value. This truth table shows the rule:
A | !A | !!A |
---|---|---|
false | true | false |
true | false | true |
Rewrite the following if
statement:
if ( !(value != 399) ) System.out.println("Correct Value"); else System.out.println("Wrong Value");