New course! Every coder should learn Generative AI!
Try a free lesson0
Int a=10 System.out.println(~a) the answer is -11 how?? Explains me.
6 Answers
+ 3
++
+ 1
it's ++
+ 1
++ its a answer
+ 1
++
- 3
The ~ operator inverts all bits of that integer.
10 in binary is 0...01010, so inverted it's 1...10101 which is -11 in the 2's complement representation.
- 3
Fill in the blanks to print 11.
int a = 10;
a;
System.out.println(a);
++
Unlock
Hint