Book Image

Learning Java by Building Android Games

By : John Horton
Book Image

Learning Java by Building Android Games

By: John Horton

Overview of this book

Table of Contents (17 chapters)
Learning Java by Building Android Games
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Expressing yourself in Java


Let's try using some declarations, assignments and operators. When we bundle these elements together into some meaningful syntax, we call it an expression. So let's write a quick app to try some out.

Here we will make a little side project so we can play with everything we have learned so far. We will need to create a new project, just as we did in the previous chapter but we will not need a UI this time.

Instead, we will simply write some Java code and examine its effects by outputting the values of variables to the Android console, called logcat. We will see exactly how this works by building the simple project and examining the code and the console output:

Tip

The following is a quick reminder of how to create a new project.

  1. Close any currently open projects by navigating to File | Close Project.

  2. Click on Start a new Android Studio project.

  3. The Create New Project configuration window will appear. Fill in the Application name field and Company Domain with packtpub...