(ii)Explain two (2) programming situations that will require the use of overloaded methods [5 marks]
One of the example where overloaded methods are used in Java itself: there is String class that has a few valueOf methods that accept different arguments and convert the entry value to the String object. The meaning of using such methods is: the business value which they (overloaded methods) are doing are the same, but the possible set of entry arguments might vary. That is why we need to use such programming construction as overloaded methods.
Comments
Leave a comment