Using … != null still is the way to do it in Java 8 and even Java 11. Otherwise, it’s like using a smartphone to hammer a nail into the wall, “to show the 2018 way of doing it”.
Read moreCan you == null in Java?
7. == and != The comparison and not equal to operators are allowed with null in Java . This can made useful in checking of null with objects in java.
Read moreCan an object be null in Java?
According to the Java spec, null is a type that can be assigned to an object variable (as a value as noted in the comment). You cannot instantiate or create variables of this type though, you must use the literal null provided by the compiler.
Read more