java一个优雅的单例模式写法

public class NetWorkManager {

    private static final class MInstanceHolder {

        static final NetWorkManager mInstance = new NetWorkManager();

    }

    public static NetWorkManager getInstance() {

        return MInstanceHolder.mInstance;

    }

}

你可能感兴趣的:(java一个优雅的单例模式写法)