Java boolean values not equal but equal? -


i'm learning java website called udacity , question got asked "done boolean value. value of !!done?" didn't understand after while of guessing got correct answer of "done." explain me? isn't ! supposed mean "not equal"? how can value1 equal value2 supposed "not equal" value1?

this goes boolean algebra, if

true = true    false = false 

then

not true = false not false = true 

so means

not (not true)  = not false = true  not (not false) = not true  = false  

which means !!done = done

you can write "not" "!"

!true  = false !false = true 

which means

!!true  = !false = true !!false = !true = false 

so if done boolean: true or false, when put in !!done done. example:

boolean done = true; 

!!done initial value true


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -