Java Statement

In Java, a statement is a complete description of a process, as a link in the flow chart.

Such as:

float price = 2.4; // is a statement
int number; // is a statement
number = 9; // is a statement
float money = price * number; // is a statement
; // empty statement
// blank lines are not statements, comments are not statements, they do not produce any operation
money; // is not a statement that does not produce any action
=; // is not a statement that does not produce any action
  • The end of the sentence usually ends with a semicolon in English
  • Multiple statements can be written on the same line, separated by semicolons
  • A statement can be split into multiple lines, the end of the end of the three English points, said the next line with
int num = 1316; num = num + 1; // line multiple sentences
// more than one line
System.out.println ("Welcome to developertut!" + "developertut, programming tutorials." ...
    + "Present total" + num + "this textbook.");
  • Some statements can contain other statements, such as for statements, while statements

Although the statements are arranged in sequence, the order of execution is not always sequential. Java programs have three basic structures:

  • Sequential structure
  • Branch structure
  • Loop structure

The sequential structure is executed step by step in the order of the statements.

The branch structure and the loop structure are described separately in the next sections.

Copyright 2014-2017 by All Rights Reserved.