Activity 1.26.1.
public static boolean canPlayoutside(String weather) { if (weather.equals("rainy")) { return false; } else { return true; } }- This code can be improved!
public static boolean canPlayoutside(String weather) { if (weather.equals("rainy")) { return false; } return true; }- This code can be improved!
public static boolean canPlayoutside(String weather) { if (!weather.equals("rainy")) { return true; } return false; }- This code can be improved!
public static boolean canPlayoutside(String weather) { return !weather.equals("rainy"); }- Correct!
These code blocks are the ones you saw in the previous question and they all have the same functionality. Among these options which one is preferable?
