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) ) ;
}
}
Dinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular Computer Notes 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.
Related Articles
Basic Courses
Advance Courses