We usually use below statements to check a variable whether it is null or not.
This is using C language concept and it is a worng statement.
This is using Java API equals, but it is still a worng statement.
And this is the same situation.
Why? Because food is possible not to be an instance when checking.
Actually, it will cause NullPointerException and we always forget using try-catch to handle.
To avoid NPE, we must modify statement in a better way.