Introducing Java Method Overloading Concepts



 Method Overloading 

Exceeding the size of a method is called Method Overloading.
With method overloading, multiple methods can have the same name with different parameters.

class World {
void countries(int x) {
}
void countries(string y) {
}
|
Method Signature

Method Overloading concept is used to create the same method again and again in the same class. Method Overloading can be done by using or changing parameters. It is called "Method Signature".


Consider the following example, which has two methods that add numbers of different type.


Instead of defining two methods that should do the same thing, it is better to overload one.

GitHub Projects


Comments

Popular posts from this blog

Introducing Java Encapsulation Concept

Introducing Java Interfaces Concept

Introducing Java Method Overriding And Super Keyword