public class HelloWorld { public static void main(String[] args) { HellowWorld hello = new HelloWorld(); int maxScore=hello.getMaxAge(); System.out.println("最大年龄为:" + maxScore); public int getMaxAge(){ int stuAge[]={18,23,21,19,25,29,17}; int max=stuAge[0]; for(int i=0;i<stuAge.length;i++){ if(max<stuAge[i]){ max=stuAge[i]; } } return max; } }}
添加回答
举报
0/150
提交
取消