There are various libraries available to check if a variable is null or not. Most notable ones are :

These methods generally takes two arguments. The first is the reference that should be non-null. The second is the error message to print (usually a string literal).

There are some common scenarios where the first argument can't be null but is still checked to be null and is thus redundant.