Over a million developers have joined DZone.

Java Singleton

·
 "A single-element enum type is the best way to implement a singleton" J.Bloch


public enum Speaker {

  INSTANCE;

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

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}