What is a Java Statement?

Understanding Java Statement

Posted by Mr.Humorous 🥘 on October 12, 2018

1. Defition of Java Statement

Statements are similar to sentences in the English language. A sentence forms a complete idea which can include one or more clauses. Likewise, a statement in Java forms a complete command to be executed and can include one or more expressions.

In simpler terms, a Java statement is just an instruction that explains what should happen.

2. Types of Java Statement

  • Expression statements change values of variables, call methods, and create objects.
  • Declaration statements declare variables.
  • Control-flow statements determine the order that statements are executed. Typically, Java statements parse from the top to the bottom of the program. However, with control-flow statements, that order can be interrupted to implement branching or looping so that the Java program can run particular sections of code based on certain conditions.
    //declaration statement
    int number;
    //expression statement
    number = 4;
    //control flow statement
    if (number < 10 )
    {
    //expression statement
    System.out.println(number + " is less than ten");
    }