if(s==null||s.equals("")); if(s == null || s.length() == 0); if(s == null || s.isEmpty()); 这几种方法都能判断字符串s是否为空, 注意:要先判断是否为空,否则报错