Introduction

Many of the aspects of Java flow control are familiar to programmers who have worked with other languages, particularly C. The if, else, switch, do, and while statements behave the same way in Java as they do in C. The for loop in Java is also similar to that in C. Java also provides the concept of flow control using exceptions, which vastly simplify the task of designing programs that gracefully handle errors and exceptional conditions. Exceptions are covered in Chapter 8, “Exceptions and Assertions.”

You should already be familiar with the basics of Java flow control, so the following sections concentrate on areas that have caused people trouble in our online testing of proposed questions for this book.

Get Java 2™ Programmer Exam Cram™ 2 (Exam CX-310-035) 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.