Answers for "sorting a string in java'"

0

sort string java

import java.util.Arrays;

public class Test
{
    public static void main(String[] args)
    {
        String original = "edcba";
        char[] chars = original.toCharArray();
        Arrays.sort(chars);
        String sorted = new String(chars);
        System.out.println(sorted);
    }
}
Posted by: Guest on April-18-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language