26.Bitwise exclusive OR (XOR) operator

 // Bitwise exclusive OR (XOR) operator

/* Exclusive or means that if the two operand bits are different the result is 1; otherwise the result is 0.


Bitwise XOR Operation of 5 and 7

  0101

^ 0111

 ________

  0010  = 2 (In decimal) 


 */

class shift_exclusive_operator

{

public static void main(String arg[])

{

System.out.println(5 ^ 7);

}

}

Comments