You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Method overloading : If a class has multiple methods having same name but different in parameters or change in data type , it is known as Method Overloading.
3
+
*/
4
+
5
+
classmethod_overloading
6
+
{
7
+
intres;
8
+
voidaddition(intn1,intn2)
9
+
{
10
+
res = n1+n2;
11
+
System.out.println("Addition with two parameters");
12
+
System.out.println("Sum of "+n1+" and "+n2+" is "+res);
13
+
}
14
+
voidaddition(intn1,intn2,intn3)
15
+
{
16
+
res = n1+n2+n3;
17
+
System.out.println("Addition with three parameters");
18
+
System.out.println("Sum of "+n1+" , "+n2+" and "+n3+" is "+res);
0 commit comments