听说名字取得越长越好就不会被别人打了
2014-11-28 17:13
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.showTop3(scores);
}
public void showTop3(int[] scores) {
Arrays.sort(scores);
int num=0;
for (int i=scores.length-1;i>=0;i--) {
if(scores[i]<0||scores[i]>100){
continue;
}
num++;
if(num>3){
break;
}
System.out.println(scores[i]);
}
}
}我就不懂了。。。。我完完全全照着指导书上的来了 ,,还是报错!!
最后两个"}",你用了中文符号
我觉得楼上是正解
ps:报错的时候最好附上报错的截图,会比较方便快捷
Java入门第一季(IDEA工具)
1168053 学习 · 18753 问题
相似问题