public class Dog { static Dog d ; private Dog() { } public static Dog getDog() { if(d == null) return d = new Dog(); return d; } }
public class Dog { static Dog d ; private Dog() { } public static Dog getDog() { if(d == null) return d = new Dog(); return d; } }
转载于:https://www.cnblogs.com/dulute/p/10972217.html