你是在比较字符串吧,我试了一下可以啊。javaDoc上是这样说的:
Compares two strings lexicographically. The comparison is based on the Unicode value of each character in the strings. The character sequence represented by this String object is compared lexicographically to the character sequence represented by the argument string. The result is a negative integer if this String object lexicographically precedes the argument string. The result is a positive integer if this String object lexicographically follows the argument string. The result is zero if the strings are equal; compareTo returns 0 exactly when the equals(Object) method would return true. 
问题可能处在这两个字符串上,可以用equals试试看它们到底想不想等。