How to Create Condition Statements in JAVA

How to Create Condition Statements in JAVA

Condition Statements are the same we use in PHP but the syntax is different in JAVA. In this article, you will learn How to Create Condition Statements in JAVA

Example:-

public class MyClass {
  public static void main(String[] args) {
    int time = 22;
    if (time < 10) {
      System.out.println("Good morning.");
    } else if (time < 20) {
      System.out.println("Good day.");
    }  else {
      System.out.println("Good evening.");
    }
  }
}

Also, Read on Facebook

Leave a Reply

Your email address will not be published. Required fields are marked *