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)

Image of Timescale

Timescale – the developer's data platform for modern apps, built on PostgreSQL

Timescale Cloud is PostgreSQL optimized for speed, scale, and performance. Over 3 million IoT, AI, crypto, and dev tool apps are powered by Timescale. Try it free today! No credit card required.

Try free

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay