What is the need of method overloading? What would happen if this feature is not present in Java?
Overloading allows you to write more than one method in the same class with the same name, but with different signatures (number and type of arguments). You can use it for example, to simplify your calls, by using the method with the least number of arguments when all defaults are acceptable. Or you can use it when you have more than one way of identifying the same thing, like (String)name and (Long)ID. In these two examples, once the overloaded methods accomplish initialization, whatever job needs to be finished can be done by a common method.
You can also use it in more complex ways, depending on the code within - just a matter of need and creativity.
Your use of this web site or any of its content or software indicates your agreement to be bound by these Terms of Participation.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.