That should read, “The return type must be the same as the parameter type.”
olivier boudigue, quoting CodeShare wrote:. . . the type of result value must be the same as the type of the parameter. . . .
olivier boudigue wrote:Like this doesn't work
That already exists in the code given. All you have to do is write another method taking an int parameter, with int return type, and doing what the rest of the question says.
olivier boudigue wrote:. . . Given a method that takes a long value and returns the max value of the long type minus the given number . . .
Elya Matsunomi wrote:. . . a simple example of overloaded method . . .
The JLS (=Java® Language Specification) only requires the two methods have the same name:-
. . . the two methods have the same modifiers, return type, method name. . . .
It also says the name is overloaded rather than the method.
That JLS section wrote:If two methods of a class . . . have the same name but signatures that are not override-equivalent, then the method name is said to be overloaded.
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koophttps://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton