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:
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,
|Operand 1||Operand 2||Result|
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...
Click on a star to rate it!
Average rating / 5. Vote count:
Let us improve this post!
Thanks for your feedback!
Jayanthi Manikandan has an undergraduate degree in Computer Science from India and a Master’s degree in Information systems with a specialization in Information security from Detroit, MI, USA.
She has been passionate about Information security and has several years of experience writing on various technical topics. Additionally, she loves to pen a few personal thoughts here as well! 🙂