
a java program using string function to input any string and print the same in alphabetical order

import java.util.*;
class ArrangeStringAlphabetically
{
public static void main(String[] args)
{
Scanner input=new Scanner(System.in);
System.out.print("Enter string: ");
String st=input.nextLine();
String str[]=st.split("");
Arrays.sort(str);
for(int i=0;i<str.length;i++){
System.out.print(str[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.