This i did by coverting it to character array and then sorted it (if there is any other approach please do let me know)
You meant you sorted a String's character alphabetically means "string" is converted to "ginrst".
the same you want to apply at the array of the String. so you can iterate over the array and can apply the same logic for each string in the Array.
If you are talking about the sorting of the Stings in the Array without changing them (reshuffling of the strings itself not characters) then you can use sort method of Array.
Do not wait to strike till the iron is hot; but make it hot by striking....
deepak carter wrote:
how to sort this without using sort method
Do you mean "without using any sort() method provided by the core API?"
If so, then just write your own sort() method. And before you ask, "How do I do that?" the answer is that you start by figuring out and writing down the basic, simple steps you would use to do it "manually".
I'm sure your intentions were great, but we don't like people to post ready-made solutions, especially in the Beginners forum. Much better to provide tips (eg, a link to sort algorithms) and let OP work it out for him/herself. I've kept a copy of your code and will restore it if my colleagues suggest I should.
Also: if you do post code, please read the UseCodeTags (←click) page first.
I also removed your duplicate post.
Isn't it funny how there's always time and money enough to do it WRONG?