Question: Are there any potential issues with the following code?
String status = getStatus();
if (status.equals("stopped")) {
// some code
}
if ("stopped".equals(status)) {
// some code
}
- First if statement might throw NullPointerException
- The condition from second if statement is always true
- Second if statement might throw NullPointerException
- Code does not compile reporting incompatible types in first if statement