In Java, there are special objects called Roots Collection Roots (GC roots). They serve as root objects for the garbage labeling mechanism (see. Figure).

This article describes four types of GC roots:
- local variables
- active threads
- static variables
- JNI Links
It is also mentioned that:
classes themselves can be garbage collected.
GC roots are not collected, so the classes themselves are not GC roots.
So what are the roots of GC for classes?
source share