Java 懒加载-静态属性

 

  public class Demo {

   private static Type instance;

              private static class TypeHolder{

                  pulbic static Type type=new Type();

               }

 

     public getInstance(){

          return TypeHolder.type;

          }

}

 

 

 

你可能感兴趣的:(懒加载)