Boolean NOT Operations: applies to one boolean operand : Logical Operators « Operators « Java Tutorial






public class MainClass {

  public static void main(String[] arg) {
    int a = 0;
    if (!(a == 0)) {
      System.out.println("a is not 0");
    } else {
      System.out.println("a is 0");
    }
  }

}
a is 0








3.7.Logical Operators
3.7.1.Boolean Logical Operators
3.7.2.The following table shows the effect of each logical operation
3.7.3.Logical operators in action
3.7.4.Demonstrate the boolean logical operators
3.7.5.Logical Operators
3.7.6.AND operator
3.7.7.&& versus &
3.7.8.Logical OR Operations
3.7.9.Boolean NOT Operations: applies to one boolean operand
3.7.10.Demonstrates short-circuiting behavior