Also, in case you're not throwing NPEs too often, the JVM actually optimizes null-checks away even if they may occur. That works because accessing address
0
will cause a segfault and the JVM can then check in the segfault handler what code caused it and throw the NPE there.