Maybe you mean something like this?

if (enemy != null) {do something}