I implement a Singleton using the enum approach:
public enum Singleton {
INSTANCE;
public void doStuff(String stuff) {
System.out.println("Doing " + stuff);
}
}
How do I call it right (I don’t mean execute, just how to write it)? Is it still a class or now an enumeration? I’m just interested in the theoretical part.
If talking about object orientation and classes, can I say I created a Singleton class of type enumeration?
An enum in Java is just a class (as you seem to know), so you should be fine calling it any of the above. It’s a bit subjective, but I think it depends on which aspects of it you want to highlight.
I would understand any of those terms, and I wouldn’t judge someone for using one vs another.