- public class SingletonD {
- /** .
- * 单例对象实例
- */
- private static SingletonD instance = new SingletonD();
-
- public static SingletonD getInstance() {
- return instance;
- }
- private void bb(){
- }
- }
- //在主activity调用的时候,如下即可
- SingletonD.getInstance().bb();
单例模式的懒汉式
最新推荐文章于 2025-07-12 21:48:22 发布
1146

被折叠的 条评论
为什么被折叠?



