Why bitwise operation (~0); prints -1 ? In binary , not 0 should be 1 . why ?
(~0);
Because ~ is not binary inversion, it’s bitwise inversion. Binary inversion would be ! and can (in Java) only be applied to boolean values.
~
!