public class Demo01 {
public static void main(String[] args) {
int Max = max(5,6);
System.out.println(Max);
}
//比大小
public static int max(int num1,int num2){
if(num1 == num2){
System.out.println("相等");
return 0;
}
int a = 0;
if (num1>num2){
a = num1;
}else{
a = num2;
}
return a;
}
}
public class Demo01 {
public static void main(String[] args) {
double Max = max(5.0,6);
System.out.println(Max);
}
//比大小
public static int max(int num1,int num2) {
if (num1 == num2) {
System.out.println("相等");
return 0;
}
int a = 0;
if (num1 > num2) {
a = num1;
} else {
a = num2;
}
return a;
}
public static int max(double num1,double num2){ //参数(顺序,值)不同,type不同
if (num1 == num2) {
System.out.println("相等");
return 0;
}
int a = 0;
if (num1 > num2) {
a = (int) num1;
} else {
a = (int) num2;
}
return a;
}
}