Chapter 5. Control Instructions

A program needs to be able to repeat code and skip over sections of the code. High-level languages like Java provide constructs such as for, if, and while for structured programming. Control structures like for, if, and while make it easy to see where control of a program goes, because programs can enter each loop only at the beginning and leave at the end. The idea behind structured programming is that larger units of code are divisible into smaller units, which are themselves composed of yet smaller units.

The JVM does not support structured programming directly. The only unit of code is the instruction. In place of structured programming constructs, the JVM provides instructions to jump directly from one place ...

Get Programming for the Java™ Virtual Machine now with O’Reilly online learning.

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