This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Sorting of string elements in alphabetical order Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Sorting of string elements in alphabetical order" Watch "Sorting of string elements in alphabetical order" New topic
Author

Sorting of string elements in alphabetical order

lmahesh kumar
Greenhorn

Joined: Feb 27, 2003
Posts: 15
Hi,

I am having an string array of some size.
\
I want to sort in alphabetical order .

Pls give me the logic or simple example .



ThankS.
Mahesh L.
=========
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
Collections.sort(Arrays.asList(yourArray));
David Harkness
Ranch Hand

Joined: Aug 07, 2003
Posts: 1646
Or Arrays.sort(array). There's a version that takes a Comparator if you need to do case-insensitive sorting: Arrays.sort(array, String.CASE_INSENSITIVE_ORDER).
 
jQuery in Action, 2nd edition
 
subject: Sorting of string elements in alphabetical order