Chapter 4. Statements

This chapter ends our tour of Java's non-object-oriented language features with a thorough examination of statements. The discussions in this chapter define the statement feature and explore Java's various statements, including decision, loop, and loop control statements.

Types of Statements

Programs evaluate expressions and execute statements. A statement takes an expression's value and uses that value as the basis for a meaningful action. For example, a statement can use a value to make a decision, use a value to control the number of times another statement executes, declare a variable and assign a value to that variable, and so on. The expression and statement features work in partnership to control a program's execution. ...

Get Java™ 2 by Example, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.