CHAPTER 13 — Single-branch if Statements

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.
go to home page   hear noise   go to next page

Revised: 09/30/98, 01/20/00, 03/30/00, 05/15/03, 01/14/06

CHAPTER 13 — Single-branch if Statements

plate of cookies

This chapter looks at more ways to make decisions.

Chapter Topics:

  • Single-branch if statements
  • Boolean expressions that use arithmetic
  • Picking the right relational symbol
  • Several if statements in a program

QUESTION 1:

You are walking through the shopping mall and are a little bit hungry. Pleasant aromas tempt you as you pass by a cookie store. What will you do?