package Muke;
public class HelloWorld {
//完成 main 方法
public static void main(String[] args) {
HelloWorld hello = new HelloWorld();
int maxScore = hello.getMaxAge();
System.out.println(maxScore);
}
public int getMaxAge(){
int[]ages = {18,23,21,19,25,29,17};
int max = 0 ;
for(int age: ages ){
max = max >= age ? max :age;
}
return max;
}
}
请问 max = max >= age ? max :age; 该怎么理解那?
blovetu
Ms_Mavis
KXFT
相关分类