Member-only story
Control Flow Statements in Java
Control flow statements are used to break up the flow of execution by employing decision making, looping, and branching.
3 min readDec 9, 2020
Control flow statements, break up the flow of execution by Decision making, Looping, and Branching. These control flow statements are used to conditionally execute particular blocks of code.
Types of Control Flow Statements
- Decision — making statements: if, if-else, switch
- Looping statements: while, do-while, for
- Branching statements: break, continue, return
In this article, I will show, how you can use decision making control flow statements
Decision-making statements
Often we want the computer to carry out a test on some data and then take one of a choice of actions depending on the result. decision-making statements are very useful in such situations.
Comparing Values
To compare numbers we can use relational and logical operators.
Relational --> <, >, <=, >=, ==, !=
Logical --> &&, ||, !