Java-Bitwise NOT

Bitwise NOT( ~ )

The Bitwise NOT is represented by the symbol (~) . Bitwise NOT is an unary operator and inverts all the bits represented by its operand. That is, 0s become 1s and 1s become zero.



Program Source

public class Javaapp {

    public static void main(String[] args) {
        byte a = 3;
        byte b = (byte)~a;
        System.out.println("Value of b = "+b);

Leave a Comment