Skip to content

Latest commit

 

History

History
19 lines (14 loc) · 432 Bytes

null_as_absence.md

File metadata and controls

19 lines (14 loc) · 432 Bytes

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);
~}