Find XOR of two number without using XOR operator | Java program to find XOR without using ^ ; Returns XOR of x and y ; Driver Code
import java . io . * ; class GFG { static int myXOR ( int x , int y ) { return ( x y ) & ( ~ x ~ y ) ; } public static void main ( String [ ] args ) { int x = 3 , y = 5 ; System . out . println ( " XOR ▁ is ▁ " + ( myXOR ( x , y ) ) ) ; } }