Home Tutorialhelp Allcomments Java Master Java Java Bitwise Xor

 
 

Comments

 
User Comments for the tutorial:

Java Bitwise XOR "^" Operator



Total comments: 10      View Tutorial    Discuss: Java Bitwise XOR "^" Operator
Advertisement
Comments

XOR 1^1 = 0
This article is wrong. In java 1^1 returns 0, not 1. If this was tested the error would be discovered right away. 

comment
"The bitwise XOR "^" operator produces 1 if both of the bits in its operands are different." How about this: 2^1 = 3 and 2^3=1 

XOR
Exclusive-OR (XOR) produces a logical true only in the condition that the two values are different. 0 ^ 0 = 0 0 ^ 1 = 1 1 ^ 0 = 1 1 ^ 1 = 0 OR produces a logical true if any value is true. 0 | 0 = 0 0 | 1 = 1 1 | 0 = 1 1 | 1 = 1  

XOR Truth table
The text in the description "Moreover if both of the bits are 1 i.e. 1^1 then also it produces 1." is obviously wrong. Goes against the very definition of Exclusive OR. For 1 1 the output should be 0. http://en.wikipedia.org/wiki/XOR 

A small inaccuracy
? "However, if both of the bits are same then this operator produces 0. Moreover if both of the bits are 1 i.e. 1^1 then also it produces 1." Improved: "However, if both of the bits are same then this operator produces 0. So even both of the bits  

Mistake
Not true: "Moreover if both of the bits are 1 i.e. 1^1 then also it produces 1" 

correction
The bitwise XOR "^" operator produces 1 if both of the bits in its operands are different. However, if both of the bits are same then this operator produces 0. Moreover if both of the bits are 1 i.e. 1^1 then also it produces 1. WRONG!!! It sho 

Mr
"Moreover if both of the bits are 1 i.e. 1^1 then also it produces 1." I think this would produce 0.  

Please provide right information
1^1 in java does return 0 not 1. 

Error in xoR operatior
1^1 =0 But this tutorial give the wrong information.  

Related Tutorial and Articles
Java Tips and Examples

Java Bitwise XOR "^" Operator
:\unique>java BitwiseXOR ^ XOR operator 1 ^ 0 = 1 C:\unique>... Java Bitwise XOR "^" Operator       In this section, you will learn how to use bitwise XOR 

Core Java

Java XOR operator
Java XOR operator       Java makes available the bitwise operators like AND, OR, XOR, and NOT. .../master-java/java-bitwise-xor.shtml http:/www.roseindia.net/software-tutorials 

Development process Questions

xor operator not working correctly with array
",a[0],a[1]); }   hi friend, This is because the XOR operator is valid... link http://www.roseindia.net/java/master-java/java-bitwise-xor.shtml   .../java/master-java/java-bitwise-xor.shtml 

Java Tips and Examples

Java XOR Operator
Bitwise XOR (exclusive or) "^" is a Java operator.... But  if both of the bits are same then the XOR operator gives the result 0. Following example will show how to use "^" operator in Java. XOR 

MySQL

Mysql XOR
. The output of the XOR is 0 when both the specified inputs are same. The output is 1... Query XOR return you '1' when 0 xor 1 or  0 xor1 (different types of input ). mysql> SELECT 0 xor 1; +---------+ | 0 xor 1 

Java Beginners

bitwise operators
this program give the answer as 7  hi friend, Bitwise OR (|) operator returns 1 if either side of operand is 1 else it returns 0 i.e. in this case the bitwise...://www.roseindia.net/java/master-java/java-bitwise-or.shtml 

Ant Questions

xor operator not working correctly with array
] = {2,3}; printf("before swapping: %d %d\n",a[0],a[1]); //a[0] ^= a[1]; //a[1] ^= a[0]; //a[0] ^= a[1]; //this is working correctly. a[0] ^= a[1] ^= a[0...",a[0],a[1 

Ant Questions

xor operator not working correctly with array
] = {2,3}; printf("before swapping: %d %d\n",a[0],a[1]); //a[0] ^= a[1]; //a[1] ^= a[0]; //a[0] ^= a[1]; //this is working correctly. a[0] ^= a[1] ^= a[0...",a[0],a[1 

General

Bitwise and Bit Shift Operators
 1  0  0  1 II. Bitwise...;    In Java the bitwise and bit shift operators are used..., the value of a bit which is 0 become 1 and vice versa. For example the value 7 

Java Interview Questions

adding two numbers using bitwise operators
, and, temp; and = x & y; xor = x ^ y; while(and != 0 ) { and <<= 1; temp...adding two numbers using bitwise operators  adding two integer numbers with using bitwise opeators   Hi Friend, Try the following code 

Advertisements Advertisements
 

 

 

DMCA.com