为了账号安全,请及时绑定邮箱和手机立即绑定

求大神解答一下这个为啥显示num++;这行出错呀?谢谢0.0

求大神解答一下这个为啥显示num++;这行出错呀?谢谢0.0

慕粉3322918 2016-05-25 14:40:04
import java.util.Arrays; public class HelloWorld{     public static void main(String[] args)    {    int[] scores={89,-23,64,91,119,52,73};    System.out.println("本次考试的前三名为:");    HelloWorld hello=new HelloWorld();    hello.max3(scores);    }    public void max3(int[] scores)    {       Arrays.sort(scores);       int num = 0;       for(int i=scores.length-1;i>=0&&num<3;i--)       {          if(scores[i]<0||scores[i]>100);          continue;          num++;          System.out.println(scores[i]);       }    }}
查看完整描述

3 回答

已采纳
?
冰山点水

TA贡献109条经验 获得超149个赞

for循环里面if语句的条件后面的分号去掉。建议按标准格式写代码:if(条件){语句}

查看完整回答
5 反对 回复 2016-05-25
?
惟愿_无事常相见

TA贡献30条经验 获得超25个赞

你把for循环里面if语句后面的分号删掉试试。。

查看完整回答
3 反对 回复 2016-05-25
  • 3 回答
  • 0 关注
  • 1371 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信