Thursday, October 16, 2008


Java sort() Method Example

If you want to sort string characters then this example is the best for you. The sort() method sort words in ascending order. Look a simple example of sort() method given below :

import java.util.*;
import java.io.*;
import java.lang.String;

public class sortstr{
public static void main(String args[]){
String str = "Java String Example";
char[] content = str.toCharArray();
java.util.Arrays.sort(content);
String sorted = new String(content);
System.out.println(content);
}
}

Result : EJSaaegilmnprtvx


7 comments:

Unknown said...

hey thanks for all the information about Java. I am not much, actually not at all aware about the Java. Can you tell me what are the basic things should be known by me in prior to learn Java completely.??? I want to learn Java..

coolwebdesigner2k said...

Derek Thank you for the coding. This is really helpful for me to start with.

Anonymous said...

I am glad I checked out your site it's really cool. Thanks!

Anonymous said...

Dear Bhai my email was hacked so I can't get in touch with you. Tried digital point but you are not there anymore if you can please send me email here yanjiaren8@gmail.com as soon as you can, your didi

coolwebdesigner2k said...

Hey Guys,

Thank you for the example. I love Java.

Ladies Shoes

David James said...

Very nice information on java.
==> Cheap used cars for sale

mack said...

Wow... It was great, I will save this post that will be helpful to learn java. thanks for it

Semi trucks for sale
Peterbilt trucks for sale