请问这个作业怎么改
public void testSort2() throws IOException {
List<String> rList=new ArrayList<String>();
Random random=new Random();
String s;
char a[] = null;
Scanner console=new Scanner(System.in);
int L=random.nextInt(10);
for(int i=0;i<10;i++) {
for(int w=0;w<L;w++) {
a[w]=(char)System.in.read();
}
s=new String(a);
rList.add(s);
System.out.print("已经成功添加"+s);
for (String c : rList) {
System.out.print("元素"+c);
}
Collections.sort(rList);
for (String c : rList) {
System.out.print("元素"+c);
}
}
}