In the Java programming language, a ‘variable’ is used to store a value. Different kinds of operations can be performed on the variables by means of ‘operators’. The Java programming language has a number of operators and these are listed below:
- Arithmetic operators(+,-,*, /,++,–,%)
- Relational operators(<,<=,>,>=,==,!=)
- Logical operators(&,|,&&,||,^)
- Conditional operators(?:)
- instanceof operator
- assignment operator(=,+=,-=)
The arithmetic operator deals with the mathematical operations of addition, subtraction, multiplication, division and modulus. The relational operators deals with comparison of the operands(or the variables used) The conditional operator is a ternary operator. The logical operators work only with boolean expressions(like true and false)
XOR operator: (^)
The XOR operator is represented with a ‘^‘. If the two operands are same, then the result is a ‘0’ or false and if the two operands are different then the result is a ‘1’ or true. For example,
[table id=5 /]
XOR operator works with both boolean values and numerical values. The numerical values will be converted to binary values and the XOR operation will be done.
This is the working of the XOR operator. This post is for alphabet ‘X’ for the BlogchatterA2Z challenge… the previous post is here...