String s=null;
        if(s==null)
        {}

解决方案 »

  1.   

    /**
         * Check the string is blank or null
         * @param str the checked string
         * @return if the string is blank or null,return true.Otherwise return false.
         */
        public static boolean isBlankOrNull(String str)
        {
            if((str == null) || ( str.trim().length() == 0))
                return true;
            else
                return false;
        }
      

  2.   

    if(str==null || str.equals("null"))
      

  3.   

    判断是否为null可直接用 if (str==null)
    判断是否为“”空串要用 if(("").equals(str))
    不能写成 str.equals(""),否则你会遇到空指针的异常。
      

  4.   

    赞同steven_cheng(286)if (str == null) 
    就可以了
      

  5.   

    判断是否为null可直接用 if (str==null)
    判断是否为“”空串要用 if(("").equals(str))
    不能写成 str.equals(""),否则你会遇到空指针的异常。
    这样也是对的:
    if(str==null || str.equals(""))
      

  6.   

    if (str == null) {
      ……
    }null和""是两种概念啊
      

  7.   

    null 和""是两个概念,
    准确地说,字符串本身没有null一说,
    null是指对象引用为空。