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


8 comments:

Bharti 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.

kscreed said...

This is one of the most informational blog I have come across.

kscreed said...

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

Jenai 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

Cheap used cars for sale 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