請各位大神幫我看看哪錯了?
import java.util.Arrays;
public class HelloWorld {
???
??? //完成 main 方法
??? 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]);
???????? }
?????? }?
??? }
2020-06-16
import java.util.Arrays;
public class HelloWorld {
????
??? //完成 main 方法
??? 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);
????????????????????????????????????????????????????????//這里要加一個“? }? ”,因為這是兩個方法,分別是main與showTop3,不應(yīng)給把showTop3放到main方法里。
?????? 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]);
???????? }
?????? }??????????????????????????????//然后要把這個 “? }? ”去掉,不然就不對稱了。
??? }
2020-06-16
少了一個}
2020-06-15
漏了個? ?}? ??