Using || (or operator) in if statement : If Statement « Statement Control « Java Tutorial






public class MainClass {

  public static void main(String[] arg) {
    int value = 8;
    int count = 10;
    int limit = 11;

    if (++value % 2 != 0 || ++count < limit) {
      System.out.println("here");
      System.out.println(value);
      System.out.println(count);
    }
    System.out.println("there");
    System.out.println(value);
    System.out.println(count);
  }
}
here
9
10
there
9
10








4.2.If Statement
4.2.1.The if statement syntax
4.2.2.Expression indentation for if statement
4.2.3.Using braces makes your 'if' statement clearer
4.2.4.Multiple selections
4.2.5.The if Statement in action
4.2.6.The else Clause
4.2.7.Nested if Statements
4.2.8.Using && in if statement
4.2.9.Using || (or operator) in if statement