the key program:
ArrayList al = new ArrayList();
al.add("1");
al.add("2");
al.add("3");
al.add("4");
//this is wrong,why??
String[] str = (String[]) al.toArray();
//but this is crrect.
Object[] obj = al.toArray();
for (int i = 0; i < obj.length; i++) {
String str = (String) obj[i];
}