Skip to Content
Learning Java by Building Android Games - Third Edition
book

Learning Java by Building Android Games - Third Edition

by John Horton
March 2021
Beginner to intermediate
686 pages
13h 6m
English
Packt Publishing
Content preview from Learning Java by Building Android Games - Third Edition

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning Java by Building Android Games - Second Edition

Learning Java by Building Android Games - Second Edition

John Horton
Programming Android with Kotlin

Programming Android with Kotlin

Pierre-Olivier Laurence, Amanda Hinchman-Dominguez, Mike Dunn, G. Blake Meike

Publisher Resources

ISBN: 9781800565869Supplemental Content