Truth Tables and De Morgan's Rules
Read this chapter, which discusses Boolean variables as used in decision tables. Truth tables are used to collect variables and their values relative to decisions that have to be made within control structures.
11. Not Not
Answer:
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.
Not Not
Who's there?
It is useful to have some rules for rewriting boolean expressions. Here is an easy one:
|
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 |
Question 11:
Rewrite the following if
statement:
if ( !(value != 399) )
System.out.println("Correct Value");
else
System.out.println("Wrong Value");