Hi! Welcome to the ranch.
Yeah, as Tushar has pointed out, it helps if you
UseCodeTags. <--- click to find out how.
I've put them in for you this time - see how much better it looks?
There are a couple of minor compile errors in there
- missing import for scanner class
- missing an opening { for your class.
Once those are sorted your program should compile and run .
You do have a problem in the code that inputs the names.
Your print method looks ok though. I would suggest calling it after you have finished entering names just to show you what the user entered before sorting.
Or maybe even printing them names after you have entered EACH name .
That should help you get a handle on what is going on in your program.