摘要:
public String intToComplement(int num) { StringBuilder sb = new StringBuilder(); if (num >= 0) { for (int i = 0; i < 8; i++) { int temp = num % 16; if 阅读全文
摘要:
单例模式 基础概念 单例模式是什么有什么用 单例模式保证一个类只有一个实例,并提供一个可以访问该实例的方法 单例模式的几种写法 饿汉式 饿汉式是在初始化时就将单例对象创建出来。通常通过属性new创建自身。由JVM保证线程安全,但会造成内存资源的浪费 //饿汉式 public class Single 阅读全文