In the JDK documentation it states that the String method isEmpty()
is true for any string of length 0.
This is obviously true for the empty string ""
.
Are there any other string for which this is the case? I have tested line breaks and carriage returns and they have a length. I have not yet tested characters with appended backspaces.
Edit: I appreciate all the additional information in all the good answers below, however I have accepted what I believe is the most direct answer to the question.
A "string of length zero" means that the string contains no characters at all, and that includes invisible, zero-width, etc. Unicode characters.
Therefore a string whose on-screen representation is completely blank and zero-width is still non-empty if it contains a character.