• Guest, The rules for the P & N subforum have been updated to prohibit "ad hominem" or personal attacks against other posters. See the full details in the post "Politics and News Rules & Guidelines."

Need help with Java

Doodoo

Golden Member
Feb 14, 2000
1,423
0
71
K..i have a file and read all the words into array using stringtokenizer. How do I sort the array of words alphabetically? Thanks
 

GL

Diamond Member
Oct 9, 1999
4,547
0
0
Search the net for a "bubble sort" algorithm and implement that in java. It's really easy...I don't have time to write out the code but it's best anyways if you understand these sort of things by learning them yourself.

Of course, it won't be as easy as just calling a function sort();)

-GL
 

Doodoo

Golden Member
Feb 14, 2000
1,423
0
71
Hehe...i was just lookin at the bubble sort...i tried it...but when it goes to compare the two array values...it says I can't use ">" with Strings....thanks for the help.

Edit: got it!!! had to use the compareTo function along with the bubblesort...now to doing a binary search on it.... Thanks for the help
 

ASK THE COMMUNITY