-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOverLoad.java
More file actions
23 lines (23 loc) · 479 Bytes
/
OverLoad.java
File metadata and controls
23 lines (23 loc) · 479 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package foundation;
/*
* 重载
*/
public class OverLoad{
public static void main(String[] args){
int area1 = getArea(2,3);
int area2 = getArea(2,3,4);
double area3 = getArea(2.10,3.10);
System.out.println(area1);
System.out.println(area2);
System.out.println(area3);
}
public static int getArea(int x,int y){
return x*y;
}
public static int getArea(int x,int y,int z){
return x*y*z;
}
public static double getArea(double x,double y){
return x*y;
}
}