Method Overloading: changing data type of arguments

In this example, we have created two methods that differs in data type. The first add method receives two integer arguments and second add method receives two double arguments.


\begin{lstlisting}
class Adder{
static int add(int a, int b){return a+b;}
st...
...r.add(11,11));
System.out.println(Adder.add(12.3,12.6));
}}
\end{lstlisting}

Output:


\begin{lstlisting}
22
24.9
\end{lstlisting}