Return to Coding in Java with artEoz – exercises

Unreferenced objects

  1. Make sure you have the geometrie resourceIf necessary, see the Resources import webpage.
  2. Open a new plain code frame NouveauProgramme and enter the following java code:
  1. An unreferenced object is a class instance which is no more referenced by a variable or a class attribute. This object becomes unusable.
    Select the Unreferenced objects item with options menu. What do you notice? key_48
  2. Complete the following statements and compare memory diagrams with and without the Unreferenced objects option selected.
    How many objects have been created? How many are unreferenced? key_48

The Garbage collector is a mechanism of memory management where the system (the JVM in this case) is responsible for automatically reclaiming memory that is no longer in use; artEoz displays the unreferenced objects but it is not possible to highlight the work of garbage collection. Too bad.

Back to java exercises list