Control of Flow Functions

Control of flow statements enable you to control the flow of execution in a program. Control of flow statements enable programmers to break the sequential flow of programs. Several types of control flow statements are supported in Java:

  • if statements—The syntax of the if statement is as follows:

    If (expression)
        Statement;

    The if statement checks the expression value (which returns a boolean) and if the value is true, it executes the statement block. On the other hand, if the expression value is false, the statement block is skipped and execution proceeds.

  • if-else statement—The syntax of the if-else statement is as follows:

    If (expression)
        Statement1;
    Else
        Statement2;
    

    The expression is checked and if it returns true, statement1 ...

Get e-Commerce Applications Using Oracle8i and Java from Scratch now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.