Answers for "how to sort an array of srings into alphabetical order java"

4

java sort string characters alphabetically

// java sort string characters alphabetically
import java.util.Arrays;
public class CharactersAlphabetically
{
   public static void main(String[] args)
   {
      String strInput = "flowerbrackets";
      // converting string to char array
      char[] ch = strInput.toCharArray();
      // sorting char array
      Arrays.sort(ch);
      // converting char array to string
      String strSorted = String.valueOf(ch);
      System.out.println("sort string characters alphabetically: " + strSorted);
   }
}
Posted by: Guest on February-19-2021

Code answers related to "how to sort an array of srings into alphabetical order java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language