Tuesday 27 August 2013

How java ensures only one instance of an enum per JVM

How java ensures only one instance of an enum per JVM

How does Java ensure internally that only one instance of an ENUM would
exist per JVM? Is it created when application boots up and from that point
on when multiple threads access it, it will just return the object created
at startup?
Or does it implement some kind of double synchronization similar to the
singleton pattern so that even if multiple threads access it, only one
istance will be created?

No comments:

Post a Comment