Chapter 7: Making Decisions with Java If, Else, and Switch
Welcome to the final part of the first game. By the end of this chapter, you can say you have learned most of the basics of Java. In this chapter, we will learn more about controlling the flow of the game's execution, and we will also add the finishing touches to the Sub' Hunter game to make it playable.
In this chapter, we will cover the following topics:
- An example to help us remember how to use if and else
- Using switch to make decisions
- How to combine multiple types of Java control flow options
- Making sense of screen touches
- Finishing the Sub' Hunter game
Another way we get to use expressions and the decision-making operators is with Java's if, else, and switch keywords. These are ...
Get Learning Java by Building Android Games - Third Edition 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.