Simple Tips for Null-Safety in Java

Görkem Gök
Level Up Coding
Published in
8 min readJan 30, 2023

--

Photo by Debby Hudson on Unsplash

The null reference was invented by Tony Hoare[1] in 1965 and he called it “my billion-dollar mistake”[2]. There are some languages such as Dart that have sound null safety that prevents unintentional access to null variables [3]. Unfortunately, we don’t have it in Java. NullPointerException is a part of our life as Java developers. We need some techniques and principles to avoid that billion-dollar mistake.

--

--