Activity 1.4.1.
public static String whereToPlay(boolean isSunny, int temperature) { if (isSunny) { if (temperature > 70) { return "play outside"; } } return "play inside"; }
- This code can be improved!
public static String whereToPlay(boolean isSunny, int temperature) { if (!isSunny) { return "play inside"; } if (temperature <= 70) { return "play inside"; } return "play outside"; }
- This code can be improved!
public static String whereToPlay(boolean isSunny, int temperature) { if (isSunny && temperature > 70) { return "play outside"; } return "play inside"; }
- Correct!
These code blocks are the same as the ones you saw in the previous question, and they all have the same functionality. Among these options, which one is preferable?