Hi to all!!!! I Am Arpit Vijay Vergiya.
On this Blog i tried to share about Java.
I hope this blog will help you to learn many new things in java.
Keep visiting!!!
Keep sharing

by

Arrange String character wise

import java.util.Scanner;
class StringCharSort{
		
		public static void main(String args[])
		{
				Scanner sc = new Scanner(System.in);
				System.out.println("Enter a String:");
				String str = sc.nextLine();
				char ch[] = str.toCharArray();
				for(int i=0;i	for(int j=1;j
						{
								if(ch[j-1]>ch[j])
								{
										char temp = ch[j-1];
										ch[j-1]=ch[j];
										ch[j]=temp;
								}
						
						}
						
				}
				for(char c :ch)
							{
									System.out.print(c);
							}
				
		}
		
}


0 comments:

Post a Comment