Method Overloading (Cont.): The main
Method
Overloading the main
Method
The following program shows we can overload the main
method, but JVM only calls the main
method which receives string array as arguments.
It also shows we can have two or more static
methods with same name, but differences in input parameters.
However, we cannot overload two methods if they differ only by static
keyword (number of parameters and types of parameters are the same).
No Overloading the Operators
Unlike C++, Java doesn’t allow user-defined overloaded operators.
Internally, Java overloads operators; for example, + is overloaded for concatenation.