Question: 9.4.1. Overloading Methods Coding Exercise In the example below the greet(String who) method overloads the greet() method of Greeter. Notice that MeanGreeter inherits this method

9.4.1. Overloading Methods Coding Exercise

In the example below the greet(String who) method overloads the greet() method of Greeter. Notice that MeanGreeter inherits this method and it isnt overridden. After running the code, try overriding the greet(String) method in the MeanGreeter class to return Go away + the who String. 9.4.1. Overloading Methods Coding Exercise In the example below the greet(String who)

Greeter.java code: method overloads the greet() method of Greeter. Notice that MeanGreeter inherits this

Please answer the coding exercise question and fill in the code completely. Thank you!

Don't get overriding a method confused with overloading a method! Overloading a method is when several methods have the same name but the parameter types, order, or number are different. So with overriding, the method signatures look identical but they are in different classes, but in overloading, only the method names are identical and they have different parameters. 1 // overriding methods 2 g2.greet(); // This could be calling an overridden greet method in g2's class 3 g1.greet("Sam"); // This calls an overloaded greet method Coding Exercise In the example below the greet(String who) method overloads the greet() method of Greeter. Notice that MeanGreeter inherits this method and it isn't overridden. After running the code, try overriding the greet(String) method in the MeanGreeter class to return Go away + the who String

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!