package cn.study.wrapperClass;
import java.util.Arrays;
public class TestWrapper {
public static void main(String[] args) {
String a = "34 9 -7 67 25";
String [] b = a.split(" ");
Arrays.sort(b);
System.out.println(Arrays.toString(b));
}
}
為什麼9沒排序呢
public static void main(String[] args){
String a = "34 9 -7 67 25";
String [] b = a.split(" ");
int[] k=new int[b.length];
for(int i=0;i<b.length;i++){
k[i] = Integer.valueOf(b[i]);
}
Arrays.sort(k);//設置按整型排序了
System.out.println(Arrays.toString(k));
}