return password1.equals(password2);

解决方案 »

  1.   

    java.lang.String
    int compareTo(Object o)           
    Compares this String to another Object. 
    int compareTo(String anotherString)           
    Compares two strings lexicographically. 
    int compareToIgnoreCase(String str)
    Compares two strings lexicographically, ignoring case considerations
      

  2.   

    估计是你的password1是不是字符串阿
    如果的是的话,不可能用这个不行的
    不一定要用equals