Statements

A statement is a language construct that can be compiled into a set of instructions to a computer. The closest analogy from everyday life to a Java statement is a sentence in the English language, a basic unit of language that expresses a complete thought. Every statement in Java must end with a ; (semi-colon). 

Here is an example of a declaration statement:

int i;

The preceding statement declares a variable i of type int which stands for integer (see Chapter 5Java Language Elements and Types)

Here is an expression statement:

 i + 2; 

The preceding statement adds 2 to the value of the existing variable i. When declared, an int variable is assigned a value of 0 by default, so the result of this expression is 2, but it is not stored. That is why it is often combined with declaration and assignment statements:

int j = i + 2;

This tells the processor to create the variable j of type int and assign to it a value that is equal to the current value assigned to the variable i increased by 2. In Chapter 9, Operators, Expressions, and Statements, we will discuss statements and expressions in more detail.