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 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.