您的位置:首页 > 其它

remotepath != null 与 !TextUtils.isEmpty(remotepath) 的区别

2014-10-11 14:16 447 查看
remotepath != null 与 !TextUtils.isEmpty(remotepath) 的区别

!TextUtils.isEmpty(remotepath) 与 remotepath != null &&remotepath.length > 0 一样

或者初始化 remotepath = null,这时只判断 remotepath != null 也可以,如果初始化 remotepath = “” ,这时必须 用!TextUtils.isEmpty(remotepath) 判断

可以单独写个java main 方法检验

public class Test {

private static String str = "";

/**

* @param args

*/

public static void main(String[] args) {

setText();

}

public static void setText(){

if(str != null)

System.err.println("daying");

}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: