Android 判断字符串是否相等

在Android中:
判断两个String是否相等不能直接用== 或!=,需要用equals()判断,若相等,则返回1

String a = "hello";
String b = "world";
if (a.equals(b) {
    System.out.println("不一致");
}else{
    System.out.println("一致");
}
原创文章 57 获赞 381 访问量 20万+

猜你喜欢

转载自blog.csdn.net/xiaozhezhe0470/article/details/105045688