I want to check for null or empty specifically in my code. Does empty and null are same for StringBuilder
in Java?
For example:
StringBuilde
No. empty
means, that there are no characters in the StringBuilder. null
means that there is no StringBuilder object at all.
A variable is only null
if it has a reference type (for example String, StringBuilder, Set, as a thumbrule: all capitalized types) and it is not initialised yet or has been set explicitly to null
.