Chapter 7. Garbage Collection

OBJECTIVES

This chapter helps you prepare for the exam by covering the following objectives from the “Garbage Collection” section of the Sun testing objectives.

State the behavior that is guaranteed by the garbage collection system and write code that explicitly makes objects eligible for collection.

  • Several exam questions require you to know when an object is no longer being referenced and can be garbage collected. You will be required to examine examples of program code and identify specific points within the code where an object becomes subject to garbage collection.

OUTLINE

Introduction 169

What Is Garbage Collection? 169

How Does the Garbage Collector Work? 170

When Is an Object Subject to Garbage Collection? ...

Get Sun Certification Training Guide (310-025, 310-027): Java™ 2 Programmer and Developer Exams 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.