public class CompareEx { public static void main(String args[]) { String[] str = {"aaa","bbb","ddd","ccc"}; String temp; for(int i=0; i