Java Unary Operator Example: ~ and !

Java Programming Language Operators in java (Article) Operators in java (Program)

5203

Program:

public class OperatorExample {
    public static void main(String args[])
    {  
    int a=10;  
    int b=-10;  
    boolean c=true;  
    boolean d=false;  
    System.out.println(~a);  
    System.out.println(~b);  
    System.out.println(!c); 
    System.out.println(!d); 
    }
} 

Output:

22
21

This Particular section is dedicated to Programs only. If you want learn more about Java Programming Language. Then you can visit below links to get more depth on this subject.