Skip to content

Commit 9085532

Browse files
committed
feat: Add Bitwise3 class demonstrating bitwise XOR operation
Add a program that: - Initializes two integers using binary literals - Performs a bitwise XOR (`^`) operation - Prints the result of the XOR computation - Highlights how XOR compares bits in Java.
1 parent 132dd7b commit 9085532

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed
Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
1-
public class Bitwise3
2-
{
1+
public class Bitwise3 {
32
public static void main(String[] args) {
43
int x = 0b1010; //10;
5-
64
int y= 0b0110; //6;
75

86
int z;
9-
10-
z = x ^ y;
11-
//XOR Operation
7+
z = x ^ y; //XOR Operation
128

139
System.out.println(z);
1410
}
15-
}
11+
}

0 commit comments

Comments
 (0)