package com.mydemo;
import java.util.Arrays;
public class Demo04 {
public static void main(String[] args) {
Demo04 demo=new Demo04( );
int maxScore = demo.getMaxAge();
System.out.println("最大年龄为"+maxScore);
}
public int getMaxAge( ){
int[] ats= {18,23,21,19,25,29,17};
int max = ats[0];
for(int i =0;i<=ats.length;i++){
if(ats[i]>max){
max=ats[i];
}
return max;
}
}
}
亂世驚夢
相关分类