大手能帮我看下错在哪里啊???
import java.util.Arrays;
public class helloWorld {
//完成 main 方法
public static void main(String[] args) {
int[]scores={89,-23,64,91,119,52,73};
helloWorld hello=new helloWorld();
int[]sett= hello.arrayini(scores);
Arrays. sort(sett);
hello.print(sett);
}
//定义方法完成成绩排序并输出前三名的功能
public int[] arrayini(int[]org){
int length=org.length;
for (int i=0;i<length;i++) {
if(org[i]<0||org[i]>100){
for(int j=i;j<length;j++){ org[j]=org[j+1];
};
length--;
}
int[] cuttail;
for(int p=0;p<length;p++){
cuttail[p]=org[p] ; }
}
return cuttail;
};
public void print(int[] num){
System.out.println("考试成绩的前三名为;");
for(int k=1;k<=3;k++){
System.out.println(num[num.length-k]);
}
}
}
我修改后的代码!!!感谢各位大神相助,通过测试了
package myself.me;
import java.util.Arrays;
public class helloWorld {
//完成 main 方法
public static void main(String[] args) {
int[]scores={89,-23,64,91,119,52,73};
helloWorld hello=new helloWorld();
int[]sett= hello.arrayini(scores);
Arrays. sort(sett);
hello.print(sett);
}
//定义方法完成成绩排序并输出前三名的功能
public int[] arrayini(int[]org){
int length=org.length;
for (int i=0;i<length;i++) {
if(org[i]<0||org[i]>100){
for(int j=i;j<length-1;j++){ org[j]=org[j+1];
};
length--;
}
}
int[] cuttail=new int [length];
for(int p=0;p<length;p++){
cuttail[p]=org[p] ; }
return cuttail;
};
public void print(int[] num){
System.out.println("考试成绩的前三名为;");
for(int k=1;k<=3;k++){
System.out.println(num[num.length-k]);
}
}
}