O'Reilly logo

Java 2™ Programmer Exam Cram™ 2 (Exam CX-310-035) by Marcus Green, Bill Brogden

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Object Garbage

We looked at the creation of objects using constructors in Chapter 4, “Creating Java Classes.” Now we'll look at how objects are destroyed. Unlike C, Java does not allow for explicit destruction of objects. Instead, the memory space used by an object that is no longer reachable by the program is reclaimed by a method quaintly called “garbage collection.” It could be more appropriately named memory recycling. For an excellent, detailed description of how the inner workings of Java accomplish this, see the book Inside the Java Virtual Machine by Bill Venners (see the “Need to Know More?” section for more information).

The JVM can maintain control of all available memory because all object creation goes through the same mechanism. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required