I tried to use counter to count the amount of null or empty string. But it always failed. I print them to test it.
System.out.println(samples.get(0).getAuthor2());
System.out.println(samples.get(0).getAuthor2() == " ");
System.out.println(samples.get(0).getAuthor2().isEmpty());
System.out.println(samples.get(0).getAuthor2() == null);
The result is like this. If these are all false, what is this blank?
To test String you have to use equals method so you have
System.out.println(samples.get(0).getAuthor2().equals(" "));
to be true
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments