Skip to content
Sharp

Modern Java · interview question

Which pattern is effectively implemented when using enums to represent singletons?

Multiple choiceHardchapter-7-curatedpremiummodern-javaenums
java
enum Singleton {
    INSTANCE;
    void performAction() { /* implementation */ }
}
Choose one answer
Answer and explanation

Correct answer

A. Singleton pattern

Why

Using an enum to represent a singleton is a robust way to implement the Singleton pattern. It provides serialization safety and ensures a single instance even in the presence of multiple class loaders.

Test yourself on Modern Java

A free test with instant, explained results. No account needed.

Start free test
All Modern Java questions →