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 4: Structuring Code with Java Methods

As we are starting to become comfortable with Java programming, in this chapter, we will take a closer look at methods. Although we know that we can call them to make them execute their code, there is more to them that hasn't been discussed so far.

In this chapter, we will cover the following topics:

  • The structure of methods
  • Method overloading versus overriding
  • How methods affect our variables
  • Method recursion
  • Using our knowledge of methods to progress the Sub' Hunter game

First, let's go through a quick method recap.

Methods

Tip

A fact about methods: almost all our code will be inside a method!

Clearly, methods are important. While this book will typically focus on the practical- getting-things-done ...

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