Chapter 7. Java Statements

Java Statements

Statements are the way we get things done in a program. Statements live in methods and in blocks. Any statement may be prefixed by a label, as shown here:

months: for(int m = 1; m <= 12; m++) { ... 

The general syntax for a statement is this:

optIdentifier: statement 

Java doesn’t have a goto statement. If a label appears, it is either just empty documentation (rare—use a comment instead), or it is used ...

Get Just Java™ 2, Fifth Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.