public class Dog { static Dog d ; private Dog() { } public static Dog getDog() { if(d == null) return d = new Dog(); return d; } }