11.22. Code Practice with Object Oriented Concepts

Write a method that overloads the talk method by taking in a name and printing “Hello” with that name.

Overloading is when several methods have the same name but different parameter types, order, or number. In this case, the original method had no parameters and we overloaded it by creating a talk method with a String parameter.

Show Comments

Create an interface named Test that has a void talk method and void walk method. Check your answer with the answer tab instead of running it!

We declare an interface similar to how we declare a class, first putting its access modifier (public, private, etc) then what it is, which in this case would be interface. Since it is an interface, it is important to remember that the methods cannot have a body.

Show Comments
Next Section - 11.23. Free Response - Trio A