views:

100

answers:

1

5.121 ____ simplifies expression in which ! is applied to && or ||

This showed up on my quiz in Java. I have no idea what it is and it is not multiple choice. Could someone help me?

+14  A: 

The answer the teacher is probably looking for is De Morgan's laws. You can take an expression such as !p && !q and rewrite it as !(p || q), which is arguably easier to read. This is actually a universal law of booleans that is not particular to any language like java.

Mike Axiak
Dean Harding
Yeah De Morgan's law is the answer! +1
fastcodejava
KitsuneYMG
@KitsuneYMG: The differences are very slight. As long as you don't do: Boolean result = (p) ? Boolean.FALSE : Boolean.TRUE :P
Mike Axiak