Online Software Educational Training - IT Tutorials - Online Education Training for Computer Software


Home

JAVA PROGRAMMING

Overloading  Method

Method overloading

One of the important features in any programming language is the use of names. When you create an object, you give a name to a region of storage. A method is a name for an action. By using names to describe your system, you create a program that is easier for people to understand and change. It's a lot like writing prose  the goal is to communicate with your readers.

In Java it is possible to define two or more methods within the same class that share the same name, as long as their parameter declarations are different. When this is the case, the method are said to be overloaded, and the process is referred to as method overloading. Method overloading on of the ways that Java implements polymorphism.

Here is a sample program that uses method overloading:






Previous

Next