by Dinesh Thakur

Array.sort():- It is a predefined method of Array class present in java.util package. It used to sorts all the elements of an array in ascending order.

Syntax:- static void sort(array)

Here is the Java Example for Sorting Strings into Alphabetical Order:

import java.util.*;

import java.io.*;
public class ArraySort
{
                      public static void main(String args[])
           {
                           System.out.print("Please Enter String for Sorting : ");
                           Scanner s=new Scanner(System.in);
                           String s1=s.nextLine();
                           s1=s1.toLowerCase();
                           char[] SortingStrings=s1.toCharArray();
                           Arrays.sort(SortingStrings);
                           String sorted=new String(SortingStrings);
                           System.out.println("After Sorting Strings into Alphabetical Order : "+sorted);
            }
}

 Java.util.Arrays.sort