DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Ivan has posted 1 posts at DZone. View Full User Profile

Java Singleton

04.03.2009
| 1894 views |
  • submit to reddit
         "A single-element enum type is the best way to implement a singleton" J.Bloch

public enum Speaker {

  INSTANCE;

  public void sayLoud(String text) { ... }
}