請問哪里錯了
package com.imooc;
import java.util.Arrays;
public class HelloWorld {
??? public static void main(String[] args) {
??? int[] sco = {89 , -23 , 64 , 91 , 119 , 52 , 73};
????? System.out.println("前三名");
????? HelloWorld hello = new HelloWorld();
???? hello.s(sco);
??? ?
??? //定義方法完成成績排序并輸出前三名的功能
??? public void s(int[] scores){
??????? Arrays.sort(scores);
???? ?
??????? for(int i=0;i<scores.length;i++){
??????????? if(scores[i]>0||i<3){
??????????????? System.out.println(scores[i]);
??????????? }
??????? }
?????? ?
??? }
??? }
}
??
2017-10-09
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 arr=new HelloWorld();
??????? arr.Top1(scores);
??? }
???
??? //定義方法完成成績排序并輸出前三名的功能
???
??? public void Top1(int[] scores){
??????? Arrays.sort(scores);
??????? int sun=0;
??????? for(int i=scores.length-1;i>=0;i--){
??????????? if(scores[i]<0||scores[i]>100){
??????????????? continue;
??????????? }
??????????????? sun++;
??????????? if(sun>3){
??????????????? break;
??????????? }
???????????????
??????????? System.out.println(scores[i]);???
??????? }
??? }
???
???
}
2017-10-17
import java.util.Arrays;
public class sortLx1 {
? ??
? ? //完成 main 方法
? ? public static void main(String[] args) {
? ? ? ? int[]scores={89,-23,64,91,119,52,73};
? ? ? sortLx1 world=new sortLx1();
? ? ? ? world.showTop3(scores);
? ? ? ??
? ? }
? ??
? ? //定義方法完成成績排序并輸出前三名的功能
? ??
? ? public void showTop3(int[]scores){
? ? ? ? Arrays.sort(scores);
? ? ? ? for(int i=(scores.length-1);i>=0;i--){
? ? ? ? ? ? if(scores[i]<0||scores[i]>100){
? ? ? ? ? ? ? ? continue;
? ? ? ? ? ? }
? ? ? ? ? ? if(i>=3){
? ? ? ? ? ? ? ? System.out.println(scores[i]);
? ? ? ? ? ? }
? ? ? ? }
? ? ? ??
? ? } ? ?
}
2017-10-04
int count=0;
for(int i=scores.length;i>0;i--){
if(scores[i]>=0&&score[i]<=100){
System.out.println(arr[i]);
count++;
}
if(count==3){
break;
}
}
2017-10-03
初學(xué),還不是很懂哎