Thursday, October 16, 2008
Java sort() Method Example
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
Labels:
java sort(),
java string sort(),
sort() method
Subscribe to:
Posts (Atom)