remotepath != null 与 !TextUtils.isEmpty(remotepath) 的区别
生活随笔
收集整理的這篇文章主要介紹了
remotepath != null 与 !TextUtils.isEmpty(remotepath) 的区别
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
remotepath != null ? 與?!TextUtils.isEmpty(remotepath) 的區(qū)別
?!TextUtils.isEmpty(remotepath) ? ?與 ??remotepath != null &&remotepath.length > 0 ? 一樣
或者初始化?remotepath = null,這時(shí)只判斷?remotepath != null 也可以,如果初始化?remotepath = “” ,這時(shí)必須?用!TextUtils.isEmpty(remotepath) 判斷
可以單獨(dú)寫個(gè)java main 方法檢驗(yàn)
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");
? ?}?
}
總結(jié)
以上是生活随笔為你收集整理的remotepath != null 与 !TextUtils.isEmpty(remotepath) 的区别的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 日期和时间格式化
- 下一篇: Workspace in use or