-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMethodOverloading.java
More file actions
31 lines (21 loc) · 602 Bytes
/
MethodOverloading.java
File metadata and controls
31 lines (21 loc) · 602 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package com.tyss.corejava;
//method overloading the name should be with same and different types of arguments
//diff parameters
//types of parameters
//diff type og arg
public class MethodOverloading {
static double mul2(double d,double e) { //argument
double mul3=d*e;
return mul3;
}
static double mul2(double x ,double y,int z) { //argument
double mul3=x*y*z;
return mul3;
}
public static void main(String[] args) {
double mul1=MethodOverloading.mul2(4.0,5.7);
System.out.println(mul1);
double mul4=MethodOverloading.mul2(6.5,8.7,2);
System.out.println(mul4);
}
}