Search⌘ K
AI Features

Make Decisions

Explore how Java handles decision-making by using if, else if, and else statements. Learn to compare numbers and strings, integrate user input, and control program flow based on conditions to build dynamic, responsive programs.

Now that Java can take input, let’s make it respond to that input. You’ll use if, else, and comparison operators in this lesson to help Java make decisions.

Goal

You’ll aim to:

  • Use if, else if, and else.

  • Compare numbers and strings. ...