日期:2014-05-20 浏览次数:20796 次
import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class Hello { public static void main(String[] args) { String s[]={"5","a","8","12","c","b","d","c","a","b","e","f","f","8","22","a","f","e","15"}; int temp=0; int a=0; String c[]={}; ArrayList<String> list=new ArrayList<String>(); for(int i=0;i<s.length;i++){ list.add(s[i]); for(int j=0;j<list.size();j++){ if(!(list.get(j)).contains("a")&&!(list.get(j)).contains("f")&&!(list.get(j)).contains("c")&&!(list.get(j)).contains("b")&&!(list.get(j)).contains("e")){ a=temp++; String s1=list.remove(j); //System.out.println("次数"+a); //System.out.println("字母"+s1); c=s1.split("[a-z]"); Arrays.sort(c);//这里有问题 for(int k=0;k<c.length;k++){ System.out.println(c[k]); } } } }for(int k=0;k<c.length;k++){ System.out.println(c[k]); } } } 帮我看看为什么Arrays.sort()传入的数组没有进行排序,我是哪里出错了。