Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

loading inner class without loading the enclosing class

I was bit confused when is the inner class (non static) gets loaded by the jvm . Is it dependent on the outer class. or can it be separately loaded without loading the outer class ?

like image 605
jayendra bhatt Avatar asked Feb 08 '17 11:02

jayendra bhatt


1 Answers

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

A static nested class may well be different, as that's genuinely independent of its enclosing class.

like image 182
Jon Skeet Avatar answered Nov 10 '22 03:11

Jon Skeet