Introduction: Decisions

We introduce this chapter by providing its prerequisites, learning objectives, and overview statement.

We'll cover the following

Prerequisites

Objectives

After completing this chapter, you should be able to:

  • Write Boolean expressions
  • Use if-else statements to alter a program’s flow of control
  • Compare two primitive values of the same type
  • Compare two objects
  • Use assertions and assert statements in a program

Overview

If it isn’t one thing, it’s another. Making decisions is something we all do. And it is a task that Java programs can do. This chapter will show you the basics of how to write Java statements that can choose between two courses of action. The chapter Multiway Decisions will soon complete this discussion by considering choices among several actions.

Get hands-on with 1200+ tech skills courses.