Control Statements
Java Control Statements
The control flow statements in Java allow you to run or skip blocks of code when special conditions are met. You will use control statements a lot in your programs and this tutorial will explain how to do this
- Programs in java will be executed in sequential manner means line by line execution of statements.
- By using control statements we can control the flow of execution.
Different types of control statements: the decision making statements (if-then, if-then-else and switch), looping statements (while, do-while and for) and branching statements (break, continue and return).
Type Of Control Statements
The control statement are used to controll the flow of execution of the program . This execution order depends on the supplied data values and the conditional logic. Java contains the following types of control statements:
- Selection Statements / Decision making Statements.
- Repetition Statements / Iteration statements.
- Branching Statements
Selection Statements / Decision making Statements :
- In some cases we will have a situation like need to execution set of statements based on a condition
- In this scenario we need to use decision making statements in java.
Selection Statements / Decision making Statements :
- if statement
- if-else statement
- if-else-if statement
- switch statement
Repetition Statements / Iteration statements :
- while loop statements:
- do-while loop statements:
- for loop statements:
Branching Statements:
- Break statements:
- Continue statements
- Return statements:
