As we know that a method have its own signature which
is known by method's name and the parameter types. Java has a powerful feature
which is known as method overloading. With the help of this feature we can
define two methods of same name with different parameters. It allows the
facility to define that how we perform the same action on different type of
Here is an example of the method overloading. Create a class "mol" and subclass "Test". Now we create two methods of same name "square" but the parameter are different. When the main class call the method the method executes on behalf of the parameter. In the given example we are trying to illustrate the same technique.
Here is the Code of the Example :
Here is the Output of the Example :
We have 1000s of tutorials on our website. Search Tutorials tutorials on our website.
Posted on: June 17, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles