Chapter 3
Control Flow
Learning Objectives
By the end of this lesson, you'll be able to:
- Control the flow of execution using the if and else statements in Java
- Check through multiple conditions using the switch case statements in Java
- Utilize the looping constructs in Java to write concise code to perform repetitive actions
Introduction
So far, we have looked at programs that consist of a series of statements that the Java compiler executes sequentially. However, in certain cases, we might need to perform actions based on the current state of the program.
Consider the example of the software that's installed in an ATM machine – it performs a set of actions, that is, it allows a transaction to occur when the PIN that's been entered by ...
Get Java Fundamentals 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.