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