About 885,000 results
Open links in new tab
  1. java - Sorting characters alphabetically in a String - Stack Overflow

    Using Arrays.sort() sort your char array Code snippet: String input = "hello"; char[] charArray = input.toCharArray(); Arrays.sort(charArray); String sortedString = new String(charArray); …

  2. Java Program to Sort Names in an Alphabetical Order

    Sep 15, 2022 · For, sorting names in an Alphabetical order there are multiple ways to sort the array, like using inbuilt Arrays.sort() method or using normal sorting algorithms like the bubble …

  3. Java – Sorting a String Array in Alphabetical Order

    Sep 16, 2022 · Learn to sort an array of strings alphabetically. In given java program, strings are given as input from console and after sorting – printed in the console. Learn to arrange an …

  4. Java Program to Sort Strings in Alphabetical Order - Tutorial …

    Write a Java program to sort strings in alphabetical order. This example allows entering the size and string items. Next, we used the Array sort function to sort the words or string arrays in …

  5. How to Sort a String Array Alphabetically in Java | Delft Stack

    Feb 2, 2024 · We can sort a string array in alphabetical or lexicographical order. Java has a built-in compareTo() method, which can be used to compare two strings and tell which one is …

  6. Sorting a String Alphabetically in Java - Baeldung

    Mar 17, 2024 · In Java 8, we can leverage the Stream API to sort the String for us: String sorted = "bdca".chars() .sorted() .collect(StringBuilder:: new, StringBuilder::appendCodePoint, …

  7. Java Program to Sort Strings in Alphabetical order - Pencil …

    Summary: In this tutorial, we will learn different ways to sort an array or list of strings in alphabetical order using the Java programming language. Example: Input: ["Python", "Java", …

  8. Java Program to Sort String in an Alphabetical order

    Mar 21, 2021 · Then to sort strings that are stored in a string array, we compare the first alphabet of each array to display them in alphabetic order in java with the help of the compareTo() …

  9. Sort a String in Java (2 different ways) - GeeksforGeeks

    Mar 18, 2024 · There exist two methods with which we can sort any string in java alphabetically. Illustration: Now let us discuss methods and implement the same. Method 1: Without using the …

  10. Java Program to Arrange Letters of a String in Alphabetical Order ...

    Write a program in Java to accept a string. Arrange all the letters of the string in an alphabetical order. Now, insert the missing letters in the sorted string to complete all the letters between …

  11. Some results have been removed
Refresh