Learning Java by Building Android Games
上QQ阅读APP看书,第一时间看更新

Chapter 3. Speaking Java – Your First Game

In this chapter, we will start writing our very own Java code at the same time as we begin understanding Java syntax. We will learn how to store, retrieve, and manipulate different types of values stored in the memory. We will also look at making decisions and branching the flow of our code based on the values of this data.

In this order, we will:

  • Learn some Java syntax and see how it is turned into a running app by the compiler
  • Store data and use it with variables
  • Learn how to express yourself in Java with expressions
  • Continue with the math game by asking a question
  • Learn about decisions in Java
  • Continue with the math game by getting and checking the answer

Acquiring the preceding Java skills will enable us to build the next two phases of our math game. This game will be able to ask the player a question on multiplication, check the answer and give feedback based on the answer given, as shown in the following screenshot:

Speaking Java – Your First Game