package com.imooc;
public class Demo01 {
public static void main(String[] args){
int[] nums=new int[]{61,23,4,74,13,123,20};
int max=nums[0];
int min=nums[0];
double sum=0;
double avg=0;
for(int i=0;i<nums.length;i++){
nums[i]>max ? max=nums[i]:max;//******这行会报错
nums[i]<min ? min=nums[i]:min;//******这行会报错
sum+=nums[i];
}
avg=sum/nums.length;
System.out.println("最大值是:"+max);
System.out.println("最小值是:"+min);
System.out.println("平均值是:"+avg);
}
}
//这段代码为什么会报错"Type mismatch: cannot convert from int to boolean"