Programs that perform the same action every time they run are all well and good, but the most interesting computer programs do something a little different each time they run, whether it's because they have differing input or even because a user is actively interacting with them. With this, let's kick-start this chapter by understanding conditional statements, then we will further explore how Java handles complicated conditional statements, modify the control flow of our program, and study loops functionality.
Specifically, we'll cover the following topics in this chapter:
- Understanding if statements
- Complex conditionals
- The switch, case, and break statements
- The while and do...while loops
- The for loop