Sort string array in java – case sensitive and case insensitive

Here’s the java program on sort string array in java – case sensitive and case insensitive,

Also read – sort string array in java

import java.util.Arrays;
public class SortStringCaseInsensitive 
public static void main(String[] args)
String strPlaces[] = new String[]{"Great Barrier Reef", "denmark", "bora bora",
"Florence","Tokyo", "cusco"};
System.out.println("CASE SENSITIVE ORDER : ");
      Arrays.sort(strPlaces, String.CASE_INSENSITIVE_ORDER);
System.out.println("CASE INSENSITIVE ORDER : ");


CASE SENSITIVE ORDER : [Florence, Great Barrier Reef, Tokyo, bora bora, cusco, denmark]
CASE INSENSITIVE ORDER : [bora bora, cusco, denmark, Florence, Great Barrier Reef, Tokyo]

Related Posts