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(){ ? ? ? 錯誤原因:Multiple markers at this line - This method must return a result of? type int - This method must return a result of? type int int []ages={18,23,21,19,25,29,17};? ? int max=ages[0];? ? for(int i=0;i<ages.length;i++){? ? ? ? if(ages[i]>max);? ? ? max=ages[i] ;? ? ? return max;? ? }哪里錯了呢,怎么修改
哪里錯誤,請問怎么修改呢?
qq_你今天真漂亮_04247659
2016-12-11 20:40:58