Exploring method overloading
As we are beginning to realize, methods are quite deep as a topic. But hopefully, by taking them a step at a time, we will see that they are not daunting in any way. We will also be returning to methods in the next chapter. For now, let's create a new project to explore the topic of method overloading.
Create a new Empty Activity template project called Exploring Method Overloading, then we will get on with writing three methods, but with a slight twist.
As we will soon see, we can create more than one method with the same name provided that the parameters are different. The code in this project is simple. It is how it works that might appear slightly curious until we analyze it after.
In the first method, we will simply call it printStuff and pass in an int variable via a parameter to be printed.
Insert this method after the closing } of the onCreate method but before the closing } of the MainActivity class. Remember to import the Log...