Classes and interfaces are represented by Class objects. When a class or interface is no longer used, there will be no references to the Class objects. This signals the garbage collector to collect unused classes and interfaces.
System.gc () invokes a thread that is defined by the JVM. I's sole purpose is to perform "garbage collection".
_________________ Please recommend my post if you found it helpful