More on NOT

The logical operator NOT is written ! when writing a program in Java. here both NOT and ! are used because it is important to know both.

Often T is written for true and F for false.

Putting NOT before a true statement creates a false statement. Putting NOT before a false statement creates a true statement. This is summarised in the truth table for NOT.

Example 1

What is the truth value of NOT $3=3$?

Answer: $3=3$ is T (true). So NOT $3=3$ is F (false).

Example 2

What is the truth value of $!3=3$?

Answer: $!3=3$ could be written as $!(3=3)$. It is the same as NOT $3=3$. therefore it is F.

Example 3

What is the truth value of "\$1000 is not less money than \$5"?

Answer: We could write this as NOT (\$1000 is less money than \$5). We know that (\$1000 is less money than \$5) is F, so NOT (\$1000 is less money than \$5) is T.

Example 4

What is the truth value of $!!5\le 6$?

Answer: $5\le 6$ is T. So $!5\le 6$ is F. Therefore $!!5\le 6$ is T.

Some for you to try

Find the truth value of each statement (that is, decide whether each is true or false).

 $5-3=0$ True False $!5-3=0$ True False $!!5-3=0$ True False $!-1\lt 1$ True False The sky is NOT always red. True False $!0=0$ True False $!!23\le 100$ True False