我這哪里錯了呀
import java.util.Araays;
public class HellWorld{
? ??
? ? //完成 main 方法
? ? public static void main(String[] args) {
? ? ? ? int[]scores={89 , -23 , 64 , 91 , 119 , 52 , 73};
? ? ? ??
? ? ? ? HellWorld hello=new HellWorld ();
? ? ? ??
? ? ? ? hello.top(scores);
? ? }
? ? ? ??
? ? ? ??
? ? ? ? public void top(int[] sco){
? ? ? ? ? ??
? ? ? ? ?Arrays.sort(sco);
? ? ? ? int nums=0;
? ? ? ??
? ? ? ? for? ? ?(int i=sco.length-1;i>=0;i--){
? ? ? ? ? ? if( sco[i]<0 || sco[i]>100? ? ? ){
? ? ? ? ? ? ? ? continue;
? ? ? ? ? ? }
? ? ? ? ? ? nums++;
? ? ? ? ? ? if(nums>3){
? ? ? ? ? ? ? ? break;
? ? ? ? ? ? }
? ? ? ? }
? ? ? ? System.out.println(sco[i]? ?);
? ? ? ? }
2018-07-19
2018-07-19
import java.util.Araays;
public class HellWorld{
? ??
? ? //完成 main 方法
? ? public static void main(String[] args) {
? ? ? ? int[]scores={89 , -23 , 64 , 91 , 119 , 52 , 73};
? ? ? ??
? ? ? ? HellWorld hello=new HellWorld ();
? ? ? ??
? ? ? ? hello.top(scores);
? ? }
? ? ? ??
? ? ? ??
? ? ? ? public void top(int[] sco){
? ? ? ? ? ??
? ? ? ? ?Arrays.sort(sco);
? ? ? ? int nums=0;
? ? ? ??
? ? ? ? for? ? ?(int i=sco.length-1;i>=0;i--){
? ? ? ? ? ? if( sco[i]<0 || sco[i]>100? ? ? ){
? ? ? ? ? ? ? ? continue;
? ? ? ? ? ? }
? ? ? ? ? ? nums++;
? ? ? ? ? ? if(nums>3){
? ? ? ? ? ? ? ? break;
? ? ? ? ? ? }
????? System.out.println(sco[i]? ?);?? }
????? ?
? ? ? ? }
2018-07-19
傳參錯了 Int[] scores.
你要理解 你傳進(jìn)去的是你定義好的數(shù)組。