mercredi 20 décembre 2017

do java enums are singleton?

do java enums are singleton?

for example :

public enum State {

ACTIVE(0),
PENDING(1),
DELETED(2),
}


State s = State.ACTIVE;
State s2 = State.PENDING;
State s3 = State.PENDING;

is java create new instances every time we use State.FOO ??

Aucun commentaire:

Enregistrer un commentaire