Chapter 9. Java Methods

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

In this chapter, we will look at the following topics:

  • Method structure
  • Method overloading versus overriding
  • A method demo mini app
  • How methods affect our variables

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

Methods revisited

The following diagram sums up where our understanding of methods is at the moment:

Methods revisited

As we can see in the preceding diagram, there are still a couple of question marks surrounding methods. We will totally take the lid off of methods and see how they work, and what exactly the other parts of the method are doing for us, later in this chapter. In Chapter 10, Object-Oriented programming, and Chapter 11, More Object-Oriented Programming, we will clear up the last few parts of the mystery of methods.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.136.17.105