請(qǐng)各位大神幫我看看哪錯(cuò)了?
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("考試成績(jī)的前三名是:");
??????? 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("考試成績(jī)的前三名是:");
??????? HelloWorld hello=new HelloWorld();
??????? hello.showTop3(scores);
????????????????????????????????????????????????????????//這里要加一個(gè)“? }? ”,因?yàn)檫@是兩個(gè)方法,分別是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]);
???????? }
?????? }??????????????????????????????//然后要把這個(gè) “? }? ”去掉,不然就不對(duì)稱了。
??? }
2020-06-16
少了一個(gè)}
2020-06-15
漏了個(gè)? ?}? ??