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;
}
哪里错了呢,怎么修改
Bran_Zuo
Its_forever
张旖旎
相关分类