You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

Empty_String_Compare.java 356 B

3 years ago
12345678910111213141516171819202122232425
  1. package Empty_String_Compare;
  2. public class Empty_String_Compare {
  3. public String bad(String input) {
  4. if(input.equals("")){ // bad 空字符串比较
  5. return "";
  6. }else{
  7. return input;
  8. }
  9. }
  10. public String good(String input) {
  11. if(input.length() == 0){ // good 空字符串比较
  12. return "";
  13. }else{
  14. return input;
  15. }
  16. }
  17. }

No Description

Contributors (1)