Sorting
When sorting in alphabetical order, Java starts with the first character of each string:
First character: 1 (for "100, Robin, HR")
First character: 1 (for "101, Peter, HR")
First character: 2 (for "200, Mary, AdminServices")
Since "100, Robin, HR" and "101, Peter, HR" start with 1, Java compares them further:
"100, Robin, HR" (less, because after 1 it has 0)
"101, Peter, HR" (more, because after 1 it has 01)
Finally, when sorting elements from the same group, the sort compares the characters one by one, which gives the order:
"100, Robin, HR"
"101, Peter, HR"
"200, Mary, AdminServices"
Final Order
The final order after sorting is:
Copy code 100, Robin, HR 101, Peter, HR 200, Mary, AdminServices
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
pul26
Highly Voted 4 years, 1 month agomaslac
3 years, 10 months ago6c84cb9
Most Recent 4 months, 3 weeks agoasdfjhfgjuaDCV
11 months agosteefaand
11 months, 4 weeks agoWilsonKKerll
2 years, 10 months ago