2 ms·
Java, if coded properly, ensures that a NullPointerException means that something went really, really wrong - in which case you're better off terminating than d
by selfhoster11 6y ago
Java, if coded properly, ensures that a NullPointerException means that something went really, really wrong - in which case you're better off terminating than doing anything else. For variables that are expected to be missing occasionally, there are the Optional types or Collections/Lists, which I use extensively.
- kaba0 6y agoIt’s an exception not an error, you can easily catch that, which may make sense eg. when you run third party extensions that should not bring down your whole program.