public class Test { public static void main(String args[]) { int temp=0; ArrayList List = new ArrayList(); String s1 = "abc,de.f,gAB,CDE,FGH"; String str1[] = s1.split("[,\.]"); for (int i = 0; i < str1.length; i++) { System.out.println(str1[i]); List.Add(str1[i]); } List.Sort(); System.out.println( List.Sort()); }