Thursday, May 19, 2005

Java sorting strings

// Sorts the input arguments

public static void main(String[] args)
{
//just sort the input command line args
Arrays.sort(args); // sorting works for many primitive data types
//sorting objects will be another section.
//Print the sorted array
for (int i=0; i .lt. args.length;i++)
{
System.out.println(args[i]);
}
}

No comments: