DEV Community

Discussion on: Better Null-Checking in Java

ernir profile image
Eiríkur Ernir Þorsteinsson

Tip: the first case, where null checks are used to handle resources, can usually be avoided by using a try-with-resources statement, available since Java 7. An example is available in the preceding section of the Java tutorial that is linked.