Skip to content

Instantly share code, notes, and snippets.

@krystian-booker
Created August 1, 2023 01:07
Show Gist options
  • Save krystian-booker/a1c908bafe544cb414a0b0af55ba7f25 to your computer and use it in GitHub Desktop.
Save krystian-booker/a1c908bafe544cb414a0b0af55ba7f25 to your computer and use it in GitHub Desktop.
public class Week3Task1 {
public static void main(String[] args) {
// Declare an integer variable named temperature and assign it a value of 20.
int temperature = 20;
// Use an if-else statement to print different messages based on temperature
if (temperature > 30) {
System.out.println("It's hot.");
} else if (temperature > 15) {
System.out.println("It's warm.");
} else {
System.out.println("It's cold.");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment