Friday, 15 August 2014

java - when and why use or equalto (|=) shorthand operator -


I was looking at the source code of a Java project, here I am an operator for Boolean | = found variable. Can anyone tell me what it really is? And the best way to use it.

Thanks for the answer, now amend my question: what | = The shortcut operator actually does this according to my tests:

  false | True = right wrong | Wrong = false | False = true true | True = true  

but I'm still not clear how this determines the results and in case of any use where I can use it.
thanks

a | = B; stands for a = a | B; , similarly a + = b; stands for a = a + b; is the same as

Whenever you have a = a; B; (which is rare) and want to shorten it.


No comments:

Post a Comment