📄 testmethodoverloading.java
字号:
package problem_4;
//TestMethodOverloading.java
public class TestMethodOverloading {
public static void main(String[] args) {
System.out.println("Max number of integer 3 and 4 is " + Max(3,4) + ";");
System.out.println("Max number of double float numbers 3.0 and 5.4 is " + Max(3.0,5.4) + ";");
System.out.println("Max number of double float numbers 3.0, 5.4 and 10.14 is " + Max(3.0,5.4,10.14));
}
//返回两个整型数中的较大者
public static int Max(int a, int b){
return a>b?a:b;
}
//返回两个双精度浮点数中的较大者
public static double Max(double a, double b){
return a>b?a:b;
}
//返回三个双精度浮点数中的最大者
public static double Max(double a, double b, double c){
double temp = a;
if(temp < b)
temp = b;
if(temp < c)
temp = c;
return temp;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -