
Write a JAva program that takes various string from command line and display them in sorted order.

Java display strings in sorted order:
import java.util.*;
class ArraySort{
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
System.out.println("Enter 5 strings: ");
String array[]=new String[5];
for(int i=0;i<array.length;i++){
array[i]=input.next();
}
System.out.println("Sorted Array:");
Arrays.sort(array);
for(int i=0;i<array.length;i++){
System.out.println(array[i]);
}
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.