+ 1
How to sort array of strings alphabetically
is there some other way to sort string array beside using arrays.sort >which I did use and there were an error (java.lang.nullpointerexception) at java.util.comparableTimSort... Something like that
2 odpowiedzi
+ 9
once upon a time , i got the same question ::::
see this post by me
https://www.sololearn.com/discuss/726221/?ref=app
+ 3
The error is not an issue with the sort method. The null exception could be because the array was null.
But yes, any sorting algorithm works for sorting arrays. Bubble sort, quick sort, selection, etc..
I think the easiest one is selection sort. Go through the array, find the smallest one and swap it with the first element. Then find the second smallest and swap it with the 2nd element. etc.. Until done.