Output ?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Output ??

class Example { public static void main(String args[ ]) { int a =3,b =6,c; System.out.println("a = " +a+"b = " + b); c = a&b; System.out.println("a&b = " + c); c = a | b; System.out.println("a | b = " + c); c = a^b; System.out.println("a^b = " + c); c = ~b; System.out.println("~ b= " + c); c = a<<3; System.out.println("a<<3 = " + c); c = b>>2; System.out.println("b>>2 = " + c); a = -1 c = a>>>24; System.out.println("a >>> 24 = " + c); }

16th Mar 2017, 7:24 AM
Sarang Kamble
1 Answer
+ 1
a = 3 00000011 b = 6 00000110 c = a | b; 00000010 = 2 (OR) a = 3 00000011 b = 6 00000110 c = a | b; 00000111 = 7 (AND) a = 3 00000011 b = 6 00000110 c = a ^ b; 00000101 = 5 (XOR) b = 6 00000110 c = ~b; 10000111 = -7 The bitwise complement of 6 (~7) using 2's complement. a = 3 00000011 c = a<<3; 00011000 = 24 b = 6 00000110 c = b>>2; 00000001 = 1 Not clear about this a = -1 c = a>>>24;
16th Mar 2017, 9:06 AM
เคฆเฅ‡เคตเฅ‡เค‚เคฆเฅเคฐ เคฎเคนเคพเคœเคจ (Devender)
เคฆเฅ‡เคตเฅ‡เค‚เคฆเฅเคฐ เคฎเคนเคพเคœเคจ (Devender) - avatar