public class Demo02 {
public static void main(String[] args) {
double larger =max(10.0,20.0);
System.out.println(larger);
}
public static double max (double num1, double num2) {
double result = 0;
if (num1 == num2) {
System.out.println("num1num2");
return 0;
}
if (num1 > num2) {
result = (double) num1;
} else {
result = (double) num2;
}return result;
}
public static int max (int num1,int num2) {
int result = 0;
if (num1 == num2) {
System.out.println("num1num2");
return 0;
}
if (num1 > num2) {
result = (int)num1;
} else {
result = (int) num2;
}return result;
}
public static int max (double num1,double num2,double num3) {
int result = 0;
if (num1 == num2) {
System.out.println("num1==num2");
return 0;
}
if (num1 > num2) {
result =(int) num1;
} else if (num3>num1) {result=(int)num3;
} else {
result = (int)num2;
}return result;
}
}