Java Control Statements also known as Control Structures or Flow Control statements are statements which decide the execution flow of the program. Typically the program execution begins from the first line in the main() function to the last line of that same function. However, in between this the flow of the execution can be branched(based on some condtion) or re-iterated(loops) based on some criterias. This the functionality that is provided by Control Statements in Java.
They are mainly categorized in 2 types –
- Conditional Control Statements
- Whenever a condition is to be tested depending on which particular tasks are to be performed, Conditional control statements are used.
- Looping / Iterative Control Statements
- Whenever a particular task has to be iterated for a particular number of times or depending on some condition, Looping control statements are used.
Apart from these we have 2 miscellaneous statements as – break and continue which assist in the flow controling mechanism.
This was just a theoretical overview of Java Control Statements and we will see in detail about these individual statements in futher tutorials.
Watch it on YouTube