Skip to content

Commit fedb15a

Browse files
method overloading
1 parent 7272da0 commit fedb15a

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
public class MethodOverloading {
2+
void sum (int a, int b)
3+
{
4+
System.out.println("Sum is: "+(a+b)) ;
5+
}
6+
void sum (int a, int b, int c) //different parameter
7+
{
8+
System.out.println("Sum is: "+(a+b+c));
9+
}
10+
11+
public static void main (String[] args)
12+
{
13+
MethodOverloading cal = new MethodOverloading();
14+
cal.sum (10,5);
15+
cal.sum (10, 20, 30);
16+
}
17+
}

0 commit comments

Comments
 (0)