how to sort alphabetically

i'm trying to sort a number of arrays into alphabetical order going by surname. The code looks like this

int i;

int j;

String temp;

String temp2;

String temp3;

String temp4;

// Sort the student arrays

for (i=0; i<MAX_RECORDS; i++)

{

for (j=i+1; j><MAX_RECORDS; j++)

{

if (lastName><lastName[j])

{//switch first name ordertemp = lastName;

lastName = lastName[j];

lastName[j] = temp;

//switch last name order

temp2 = firstName;

firstName = firstName[j];

firstName[j] = temp2;

//switch phone no. order

temp3 = telNumber;

telNumber = telNumber[j];

telNumber[j] = temp3;

//switch email order

temp4 = emailAddress;

emailAddress = emailAddress[j];

emailAddress[j] = temp4;

When i compile it i come up with the followin error:

operator >< cannot be applied to java.lang.String,java.lang.String

Can ne pls help its starting to do my head in

[1103 byte] By [orangecubea] at [2007-11-27 3:59:54]
# 1
Take a look at java.util.Arrays
YoGeea at 2007-7-12 9:04:29 > top of Java-index,Java Essentials,Java Programming...
# 2
i need to make it so that if lastName[2] moves to say [5] all of the information in [2] of the other arrays will also move to [5]
orangecubea at 2007-7-12 9:04:29 > top of Java-index,Java Essentials,Java Programming...
# 3
Encapsulate the information in a User Object (for example) then implement Comparable (to do the natural ordering) and use a Comparator to do any non-natural ordering.
YoGeea at 2007-7-12 9:04:29 > top of Java-index,Java Essentials,Java Programming...
# 4

Don't store your information as unlinked arrays. Use one array, whose elements contain classes that hold all the information that you're currently storing at a specific index in multiple arrays.

Make that class implement the Comparable interface.

Then look at java.utils.Arrays.

G

ggaineya at 2007-7-12 9:04:29 > top of Java-index,Java Essentials,Java Programming...
# 5
Dammit - one minute short. :)G
ggaineya at 2007-7-12 9:04:29 > top of Java-index,Java Essentials,Java Programming...