if ((user_name == txt_name.getText()) && (user_password == txt_password.getText()))
改为:
if ((user_name.equals(txt_name.getText())) && (user_password.equals(txt_password.getText())))所有的字符串比较用equals来进行。
改为:
if ((user_name.equals(txt_name.getText())) && (user_password.equals(txt_password.getText())))所有的字符串比较用equals来进行。
如果是String一定要用equals
不是尽量转变成String来比较
当比较两个引用是否相同时用==
比如String s1 = "OK";
String s2="0k";
s1.equals(s2) 返回true
s1==s2 返回false
如果是String s1 = "OK";String s2 = s1;
s1.equals(s2) 返回true
s1==s2 也返回trueString s1 = "OK";