I would like to know how can I sort one array alphabetically while sorting other arrays by that arrays' index.
for example the first array contains three names; "aaron", "jill", "bob"
the second array would have three names also; "olson", "taylor", "foster"
when it sorts the first array it will sort it into "aaron", "bob", "jill" but i want it to also sort the second one the same way it sorted the first one but based on how it sorted the first one. so it would result in "olson", "foster", "taylor".
Re: Sorting arrays
There are possibly many ways to do this. Given java is object oriented, I'd suggest to create a class which contains two values - and sort an array of objects of that class based upon one of those values.
Re: Sorting arrays
There's a bit of a problem in knowing how to respond to this. If it's a homework question, perhaps you could post it because how you tackle this depends a lot on the circumstances (what you know, and what the question is getting you to practice).
Anyway there are two broad ways of approaching it:
A) Don't use "parallel arrays" - that is, instead of splitting the data between two arrays write a Name class that includes both a first name and a surname. And have a single array of Name instances. Then you sort the array using the sort() method of the Arrays class. As the library sort() method does its thing, sorting alphabetically on the first names, the surnames get carried along for the ride.
B) Write some code that actually sorts the first name array by shuffling its elements about using some sorting algorithm you know about (or find out about: Wikipedia is your friend). Then alter that code so that it each time it does something to the first name array it does the analogous thing to the surname array. The place to start here is with some solid (compiled and tested) code to implement the first name sort.
Most people would prefer (A) since money and time has been spent getting the library sort() method fast and accurate. And since keeping the two parts of the name together will make sense in all sorts of other contexts (sorting by surname, printing the full name, etc). But, as I said, much depends on the context within which the question has arisen.