alan412 / LearnJavaForFTC

This is for learning Java for FTC
123 stars 9 forks source link

4.3 #13

Closed Joshua-Smith-42 closed 4 years ago

Joshua-Smith-42 commented 4 years ago

May 9th 2020

4.3 comanations

I know in python there is a logic operator that is exclusive or does that exist in java??? If it does it wasn't on the chart

itsteja17 commented 4 years ago

Hi Joshua,

The logic operator exclusive or does exist in Java.

Operator: ^ Example: A ^ B Meaning: return TRUE if condition A and B are different, otherwise return FALSE

alan412 commented 4 years ago

Technically, the XOR operator (^) is a bitwise operator and not a logical one in Java. I added it for completeness because it can be used like that when both arguments are boolean. However, if they are integers then it will operate on each bit in the data which may give an unexpected result.