在Android中:
判断两个String是否相等不能直接用== 或!=,需要用equals()判断,若相等,则返回1
String a = "hello";
String b = "world";
if (a.equals(b) {
System.out.println("不一致");
}else{
System.out.println("一致");
}
在Android中:
判断两个String是否相等不能直接用== 或!=,需要用equals()判断,若相等,则返回1
String a = "hello";
String b = "world";
if (a.equals(b) {
System.out.println("不一致");
}else{
System.out.println("一致");
}