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.*;

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