Null,empty and blank .
Table of contents
Null indicates there is no value at all within a database field for a given record. It does not mean or represent zero, because zero is a value. Null is simply the word used to show the absence of any data in that field. The code String nullString = null assigns a null value to the variable nullString.
A blank string indicates a value within a database, but the field is blank. contains only whitespaces, is neither empty nor null since it does have an assigned value, and isn't of 0 length (an empty string).
An empty string refers to an object that has been assigned a value but whose length is zero. The code snippet String emptyString = '' assigns an empty string value to the variable emptyString.
Subscribe to my newsletter
Read articles from Mariagoretti Kimani directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Mariagoretti Kimani
Mariagoretti Kimani
A software developer with a knack for UX research, JavaScript, HTML, CSS Kotlin, and Python.Always eager to learn and build user-centric solutions.