Why are you using compareTo() in the first place? There are lots of methods in the Character class which allow you to tell whether a char is a letter, a number, etc., etc. I think one of those methods would provide a more elegant solution to your problem.
Joined: Mar 16, 2011
thank for helping. i know how to do this.
i think i will use string.charAt(0) to compare