public class SortArrayString
public static void sortEm(String [] array, int len)
		int a,b;
	    String temp;
		int sortTheStrings = len - 1;
		for (a = 0; a < sortTheStrings; ++a)
		for (b = 0; b < sortTheStrings; ++b)
		if(array[b].compareTo(array[b + 1]) >0)
		  temp = array[b];
		  array[b] = array[b + 1];
		  array[b + 1] = temp;	
13 Years
Discussion Span
Last Post by JamesCherrill

A far easier implementation is as follows:

public static void sortEm(String[] array, int len)

Hah... I had to register to this website just to find out that I can use an already existing method to sort Strings into alphabetical order... thanks jwenting.:D


..its good to see how really sorting goes on!..
if we use java.util.Arrays.sort(array);
it makes us faster and easier!.,..
yah its much easier but this one is good to letting know your self on how sorting goes on!!
this help most students like me!!!..
well, its up to you on what you better used to be,.
the point is you understand how it goes like that and goes like this and so on and so for.....,;


Yes, this sorts the contents of array. After this call the array is in sorted order, so you can just use it.
If you have more questions please start a new topic.


does this sorting method also capable in handling more than two arrays??

i guess it does you'd just have to call it twice, once for each array to sort. but please as said above:
If you have more questions please start a new topic.

Edited by DavidKroukamp: n/a


i want to code for "Flames" a famous game which compare to persons names and give the result as
F for Friends
L for Lovers
A for argant
M for Marriage
E for Enemy
S for Sister.......
plz just give the hints i can proceed......

Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.