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;? ? } ?? ? }}
問(wèn)題在哪里?
那誰(shuí)某人
2015-12-03 17:20:12