0

I was playing around some static nested class.

package com.tutorial; 
public class MyUpperClass {
    private MyUpperClass () {

    }
    private static class MyStaticInnerClass{
                private static final MyUpperClass muc = new MyUpperClass ();
    }
    public static MyUpperClass getInstance() {
        return MyStaticInnerClass.muc;
    }
}

When does MystaticInnerClass get loaded into the JVM memory? At the time of, when MyUpperClass get loaded or getInstance() get called?

Sotirios Delimanolis
  • 274,122
  • 60
  • 696
  • 724
user19866
  • 59
  • 5

0 Answers0