by Dinesh Thakur Category: Operators and Expressions

The bitwise AND, OR, and XOR operators (&, |,and /\) all act on the individual bits of an integer. These operators are useful when an integer is being used as a bit field.

Here is the Java Example for Bitwise AND, OR, and XOR Operators

class  BitwiseANDORXOROperators 

{
            public  static  void  main  (String  args[ ] )
            {
                        int  x  =  13,  y  =  10;
                        System.out.println("x   =  "  +  x);
                        System.out.println("y  =  "  +  y);
                        System.out.println("x  &  y  =  "  +  (x  &  y) ) ;
                        System.out.println("x  |  y  =  "  +  (x  |   y) ) ;
                        System.out.println("x  ^  Y  =  "  +  (x  ^  y) ) ;
            }
}

Bitwise AND, OR, and XOR Operators

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.



Search Content