/* related posts with thumb nails */

Java statements.:

A statement is an executable combination of tokens ending with a semicolon (;) mark. Statements are usually executed in sequential order. However, it is possible to control the flow of execution, if necessary, using special statements. Java implements several types of statements as illustrated in the following Table.

Empty Statement

These do nothing and are used during program development as a place holder.

Labeled Statement

Any Statement may begin with a label. Such labels must not be keywords, already declared local variables or previously used labels in this module. Labels in Java are used as the arguments of Jump statements.

Expression Statement

Most statements are expression statements. Java has seven types of Expression statements Assignment, Pre-Increment, Pre-Decrement, Post-Increment, Post-Decrement, Method Call and Allocation Expression.

Selection Statement

These select one of several control flows. There are three types of selection statements in Java if, if-else, and switch.

Iteration Statement

These specify how and when looping will take place. There are three types of iteration statements; while, do and for.

Jump Statement

Jump Statements pass control to the beginning or end of the current block, or to a labeled statement. Such labels must be in the same block, and continue labels must be on an iteration statement. The four types of Jump statement are break, continue, return and throw.

Synchronization Statement

These are used for handling issues with multithreading.

Guarding Statement

Guarding statements are used for safe handling of code that may cause exceptions (such as division by zero). These statements use the keywords try, catch, and finally.

Related Topics:

0 comments:

Post a Comment