Null as Absence
One way to use null
is to have it be a stand in for when there is
an "absence" of a value.
Consider Cher. Unlike most people, Cher does not have a last name.
null
is an appropriate value to use when there is such an absense.
void main() {
String firstName = "Cher";
String lastName = null;
System.out.println(firstName);
System.out.println(lastName);
}