public class Compare {
public static void printMax(double... numbers){
if(numbers.length==0){
System.out.println("No argument passed");
}
double result=numbers[0];
//排序
for (int i=1;i<numbers.length;i++){
if (numbers[i]>result){result=numbers[i]
; }
}
System.out.println("The max value is"+result);
}
public static void main(String[] args) {
printMax(12,324,13,1,13);
}
}
java比大小
最新推荐文章于 2024-09-05 23:10:07 发布