Method Overloading :
If a class have multiple methods by same name but different parameters,it known as method overloading.
Different ways to overload the method :
There are two ways to overload the method in java :-
1) By changing number of arguments .
2)By changing the data type.
Example for changing number of arguments :
Example for changing data type of arguments :
If a class have multiple methods by same name but different parameters,it known as method overloading.
Advantage Of Method Overloading :
Method overloading increases the readability of the program.
Different ways to overload the method :
There are two ways to overload the method in java :-
1) By changing number of arguments .
2)By changing the data type.
Example for changing number of arguments :
Example for changing data type of arguments :
No comments:
Post a Comment