3.2. Object’s life cycle

[2.4] Explain an Object’s Lifecycle (creation, “dereference by reassignment” and garbage collection)

The OCA Java SE 8 Programmer I exam will test your understanding of when an object is created, when it can be accessed, and when it can be dereferenced. The exam also tests your ability to determine the total number of objects that are accessible at a particular line of code. Primitives aren’t objects, so they’re not relevant in this section.

Unlike some other programming languages, such as C, Java doesn’t allow you to allocate or deallocate memory yourself when you create or destroy objects. Java manages the memory for allocating objects and reclaiming the memory occupied by unused objects.

The task ...

Get OCA Java SE 8 Programmer I Certification Guide now with O’Reilly online learning.

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