Not at the Beginning and Not in the Middle of the Chapter

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          

Answer:

Using the De Morgan Rule

!(A && B && C) is equivalent to !A || !B || !C

The expression

boolean noDriving = !(daylight && passenger.age >= 21  && passenger.licensed );

is equivalent to

boolean noDriving = !daylight || !(passenger.age >= 21) ||  !passenger.licensed ;

which can be further transformed to

boolean noDriving = !daylight || passenger.age < 21 ||  !passenger.licensed ;

Not at the Beginning and Not in the Middle of the Chapter

If you are not interested or do not have the time, you may not wish to review the following.

You have reached the end of the chapter.

go to previous page   go to home page