Overloading

Categories: Java // Tags: , , .

// By:Team // No Comment

Email this to someonePrint this pageShare on Google+2Share on Facebook0Tweet about this on TwitterShare on LinkedIn0Share on Reddit0Pin on Pinterest0Share on StumbleUpon1


Overloaded
Overloaded method gives you an option to use the same method name in a class but with different argument.

Overloading Method Rules
There are some rules associated with overloaded method.

Overloaded methods

  • Must change the argument list
  • Can change the return type
  • Can change the access modifier(Broader)
  • Can declare new or broader checked exception
  • A method can be overloaded in Class or in SubClass.

Overloading Method Example

Invoking Overloaded Method
Out of several available overloaded method which method to invoke is based on the arguments.

First call will execute the first method and second will execute the second method.

Email this to someonePrint this pageShare on Google+2Share on Facebook0Tweet about this on TwitterShare on LinkedIn0Share on Reddit0Pin on Pinterest0Share on StumbleUpon1

About Team

Browse Archived Articles by Team

Related

Sorry. There are no related articles at this time.