Loading an inner class without loading a closing class

I was a little confused when the inner class (not static) loads jvm. It depends on the outer class. or can it be separately loaded without loading an external class?

+5
source share
1 answer

Given that the inner class has a field with a reference to an instance of the enclosing class, I don’t see how it can be loaded without loading the closing class.

A static nested class may be different, since it really does not depend on its enclosing class.

+14
source

Source: https://habr.com/ru/post/1263963/


All Articles