Skip to main content

Practice Code Structure

Section 1.16 Fill-in-the-blank

Checkpoint 1.16.1.

The whereToPlay() function takes a String input and prints messages. Complete the function by filling in the blanks so that when the input (weather) equals "Sunny" or "Cloudy", the function prints "You can play outside!". However, when the weather is "Windy", it prints "You should play inside!". You should use the equals() method to compare String values.
public static void whereToPlay(String weather) {
	if (.........Blank 1...............) {
        System.out.println("You can play outside!");
    } ......Blank 2........ {
        System.out.println("You should play inside!");
    }
}
Put your responses here:
Blank 1:
Blank 2:
You have attempted 1 of 2 activities on this page.