you will have to be more specific. There are no details here on what the problem is, what you expect to happen, or what does happen.
I am able to compile and run your code, as is (ok, i reformatted it to make it legible), so unless you tell us what your problem is, we can't really help.
edit: here is what I got:
C:\slop>
java sorting fred bob alic mary
Sorted order is
mary
fred
bob
alic
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors