/**
* Created by Administrator on 2017/8/25.
*/
import java.util.Arrays;
public class Tex1 {
public static void main(String[] args) {
int[] chengji = new int[]{9, -23, 64, 91, 119, 52, 73};
Tex1 hello=new Tex1();
hello.Top3(chengji);
}
public void Top3(int chengji[]) {
Arrays.sort(chengji);
int num = 0;
for (int i = chengji.length - 1; i >= 0; i--) {
if (chengji[i] < 0 || chengji[i] > 100) {
continue;
}
num++;
if (num > 3) {
break;
}
System.out.println(chengji);
}
}
}你这输出的是三个对象啊,要用toString转化为字符串,Arrays.toString(chengji)
找到了,原来是 System.out.println(chengji);没有输出数组··= =
[I@140e19d
[I@140e19d
[I@140e19d
这是运行结果