結(jié)果是三個(gè)0,為什么?
import java.util.Arrays;
public class HelloWorld{
? ? public static void main(String[] args){
? ? ? ? int[] scores={89 , -23 , 64 , 91 , 119 , 52 , 73};
? ? ? ? HelloWorld rst=new HelloWorld();
? ? ? ? rst.getSqs(scores);
? ? }
? ? public void getSqs(int[] scores){
? ? ? ? int[] realones=new int[scores.length];
? ? ? ? Arrays.sort(realones);
? ? ? ? for(int i=0;i<3;i++){
? ? ? ? ? ? if(realones[i]>100){
? ? ? ? ? ? ? ? continue;
? ? ? ? ? ? }
? ? ? ? System.out.println(realones[i]);
? ? ? ? }
? ? }
? ??
}
2017-08-25
此行代碼 : int[] realones=new int[scores.length];
創(chuàng)建出的數(shù)組為{0,0,0,0,0,0,0}