DEV Community

Guna Sekaran
Guna Sekaran

Posted on

If,else,else if,nested if in java

if condition:

Image description

if and else condition

Image description

nested if and else if condition:
Question:
If the temperature is within the range of 10 to 100 (inclusive):

Display "Temperature is very hot" if the temperature is 40 or higher.
Display "Temperature is hot" if the temperature is between 30 and 39.
Display "Temperature is warm" if the temperature is between 20 and 29.
Display "Temperature is cold" if the temperature is between 10 and 19.

Image description

Top comments (0)