在类外创建的单例类对象

时间:2015-09-14 05:29:33

标签: java singleton

有没有办法在单例设计模式中在类外创建对象?

public class Test {
     private Test() {}
     private static final Test t=new Test();

     public static Test getTest() {
        return t;  
     } 
}

0 个答案:

没有答案