Chapter 7. Exceptions, Assertions, and Threads

Today, you complete your weeklong journey through the Java language by learning about three of its most useful elements: threads, exceptions, and assertions.

Threads are objects that implement the Runnable interface, which indicates that they can run simultaneously with other parts of a Java program. Exceptions are objects that represent errors that may occur in a Java program. Assertions are conditional statements and Boolean values that indicate a program is running correctly, providing another means of detecting errors.

Threads enable your programs to make more efficient use of resources by isolating the computing-intensive parts of a program so that they don’t slow down the rest of the program. ...

Get Sams Teach Yourself Java™ 6 in 21 Days now with the O’Reilly learning platform.

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