compareTo可以比较出两个字符串不相同的一些逻辑性。
equals返回boolean,要么相同,要么不相同。

解决方案 »

  1.   

    基本同意楼上的说法
    还有利用compareTo可以对字符窜进行排序
      

  2.   

    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.