by Dinesh Thakur Category: array

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);


About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.C.A, MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.

Related Articles