ankur trapasiya wrote:well i am not understanding the output over here ..
what i think it should be is
ii=2 (because J extends I so it also should be loaded....)
anyone please explain this ...
If you dive into the JLS, you can get the answer. Here is the specification,
Before a class is initialized, its direct superclass must be initialized, but interfaces implemented by the class need not be initialized. Similarly, the superinterfaces of an interface need not be initialized before the interface is initialized. So, the super interfaces of the interface K won't be initialized when the interface K is initialized. Hence only the static fields of that interface will be initialized. So, we have that results.
|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|