Can you call equals on null?

Consequently, if both arguments are null, it returns true and if exactly one argument is null, it returns false. Otherwise, it then simply calls the equals() method of the passed argument’s type’s class – which in our case is String’s class equals() method.

Read more