Originally posted by Lenny Leon:

I'm just starting out learning Java and need a little help. I'm supposed to take this truth table and alter it so it displays 1's and 0's instead of true false. I'm assumed to do this I would just need to change the variable type and replace true and false with 1 and 0 but every way I try this does not work. I would just like for someone to point me in the right direction. I would like an explanation so I could understand instead of just an awnser. Thanks in advance

okay, so break down what !p means...

! = a boolean operator that inverts the value of a boolean...

So...

if p is true then !p ( NOT p ) is false, otherwise...

if p is false then !P ( NOT p ) is true... Hmmm... the opposite...

so if you use integers... then you could look at it like this...

if p is 1 then !p ( NOT p) then p is 0, else

if p is 0 then !p ( NOT p) then p is ???

... you can take it from here...

now you got some of the logic, making it work should be easier...