What is an overloaded method?
Ans : An overloaded method, strictly speaking, is more than one method: it is two or more separate methods (defined or inherited) in the same class that share the same name. Methods belong to classes, and methods within a class are distinguished according to their signatures: the combination of method name, number of parameters, and types of parameters (Q1.4). Accordingly, you can use the same name for different methods only if the methods contain different parameter lists. Method overloading allows you to group conceptually similar methods under the same name, and to use simpler names in general. Your method names can reflect the behavior of the methods without having to worry about how many or what types of parameters the methods take. The Math class in the java.lang package illustrates method overloading based on parameter types. It defines four different methods with the name max: • max(int, int), returns an int • max(long, long), returns a long • max(float, float), returns a float