Permanent Generation a.k.a permgen is the referred to the place where all the class related information is stored. It is occasionally referred as method-area.
Lets take an example of the following code:
public class Parent
{
...
}
Here:
new Parent()
is an object ofParent
class.(new Parent()).getClass()
refers toKlass
of Parent. The reference type for this object would bejava.lang.Class<Parent>
. This would store the information aboutParent
's annotations, constructors, fields, methods, its inheritance (superclass, interfaces) etc- KlassKlass would be
(new Parent()).getClass().getClass()
. The reference type for this object would bejava.lang.Class<java.lang.Class>
. This defines the information aboutjava.lang.Class
's annotations, constructors, fields, methods, its inheritance (superclass, interfaces), etc.
Theoretically, this chain could go on but KlassKlassKlass would be same as KlassKlass.
Inshort, KlassKlass means that you would have one java.lang.Class
object which defines the behavior of java.lang.Class
itself.
Hope this helps