Not Not Who's there?

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.
go to previous page   go to home page   go to next page        

Answer:

Study results in good grades.

Not Not
Who's there?

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
truefalsetrue
falsetruefalse

 

QUESTION 11:

Rewrite the following if statement:

if ( !(value != 399) )
  System.out.println("Correct Value");
else
  System.out.println("Wrong Value");