Shared Tutorials

Tutorials Shared by the Internet Community

Advertisements

  Top Tutorials     New Tutorials     Submit     Login     Register  

Tutorial Basic Detail

How to use Enum as Singleton in Java with Example

From Java 5 onwards there is a new way to implement Singleton design pattern, by using Enum. Enum has some distinct benefits in terms of thread-safety
http://javarevisited.blogspot.com/2012/07/why-enum-singleton-are-better-in-java.html

Description:

From Java 5 onwards there is a new way to implement Singleton design pattern, by using Enum. Enum has some distinct benefits in terms of thread-safety during instance creation, serialization guarantee by JVM and amazingly reduce amount of code which makes it perfect choice of using as Singleton class.

Rating Detail

 Stars  Percentage  Total Vote
 One star  Vote LeftVote MiddleVote Right 38.99%  62
 Two starsTwo star  Vote LeftVote MiddleVote Right 10.06%  16
 Three starsThree starsThree stars  Vote LeftVote MiddleVote Right 11.32%  18
 Four starsFour starsFour starsFour stars  Vote LeftVote MiddleVote Right 10.69%  17
 Five starsFive starsFive starsFive starsFive stars  Vote LeftVote MiddleVote Right 28.93%  46

Caste Your Vote

 Rating  Selection  Guidelines
 Poor:     Very disappointing, useless.
 Fair:     Below average, disappointing but not useless.
 Good:     About average in its class.
 Very Good:     Above average for its category.
 Excellent:     One of the best Tutorials in its category.





Advertisements