Wednesday, December 6, 2006

Statements in JAVA

Statements are equivalent to sentences in natural languages. A statement forms a complete unit of execution. The following types of expressions can be made into a statement by terminating the expression with a semicolon ( :

* Assignment expressions
* Any use of ++ or --
* Method calls
* Object creation expressions

These kinds of statements are called expression statements.

In addition to these kinds of expression statements, there are two other kinds of statements. A declaration statement declares a variable. A control flow statement regulates the order in which statements get executed. The for loop and the if statement are both examples of control flow statements.

No comments: