上QQ阅读APP看书,第一时间看更新
Chapter 3. Variables, Operators and Expressions
We are going to make good progress in this chapter. We will learn about Java variables that allows us to give our game the data it needs. Things like the sub's location and whether it has been hit, will soon be possible to code. Furthermore, the use of operators and expressions will enable us to change and mathematically manipulate this data as the game is executing.
This is what we will do in this chapter:
- Have a full discussion about Java variables including types, references, primitives, declaration, initialization, casting, concatenation and more too
- Practice writing code to use and manipulate variables with operators and expressions
- Learn about the Android coordinate system for drawing text and graphics to the screen
- Use what we have learned to add variables to the Sub' Hunter game
- See how to handle common errors
As our Java knowledge progresses we will need to introduce a little bit of jargon.