Thorsten Greiner wrote:

>* Christopher Rued [2004-05-21 18:31]:
>> (a && !b) || (!a && b).
>> There is no XOR boolean operator in Java, AFAIK.

>
>Come on guys, think before you hit that send button: the boolean
>operators in Java are:
>
> ! NOT
> & AND
> | OR
> ^ XOR
>
>There are two short-ciruit operators:
>
> && AND
> || OR
>
>These do not evaluate their right hand side expression if the left
>side is either false (&&) or true (||). You actually should find
>
>that in any entry level book on Java programming.
>

I stand corrected.

As Thorsten ever so politely pointed out, a ^ b works just fine, and is
logically equivalent to my original suggestion.

I knew of & and | as the non-short-circuit versions of && and ||, but I
didn't know that ^ was a valid operator on booleans.
I only knew of ^ as a bit-wise operator on numerical primitives before.

--Chris


_______________________________________________
freebsd-java@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "freebsd-java-unsubscribe@freebsd.org"