SOURCE CODE
class bitnot {
public static void main(String args[]) { // start of main() method.
int a = 0, b = 5, c1, c2; // initializing a & b of type integer.
c1 = ~a; c2 = ~b; // inverting a & b using "~" operator and storing in c1 & c2 respectively.
System.out.println("Inverse : "+c1+ " & " +c2); // printing result
} // ending of main() method.
} // end of the class.
OUTPUT
Inverse : -1 & -6
NOTE:-
Not ( ~ ) operator assumes -1 to 0 after inversion.
Hence whenever we invert any number we get incremented number with negative ( - ) sign.
Hence whenever we invert any number we get incremented number with negative ( - ) sign.
0 comments:
Post a Comment