Java : Types of Statements

Java method body is a series of one or more statements. In a java programming language, a statement is a basic unit of execution which follows the syntax of the language and includes one or more clauses.

Note: All java statements except blocks statement terminated by a semicolon(;).

Type of Java Statements

Java supports five different types of statements:


A block is a series of zero or more statements between a matching set of open and close curly braces.  For example :

  • The bodies of methods and switch statements are blocks.
  • The bodies of if, for, while, and do-while statements may also be blocks.
  • You can also simply create a new block inside another block by enclosing code within curly braces. A block contained within another block is itself a statement of the outer block.
  • Blocks that contain no statements are called an empty block.

Example of Statements

At the high level below are some examples of statements. You can get more detail about each type of statement in the corresponding link.

Java Block and Types of Statements
Java Block and Types of Statements