Prev Next

Java / Enum

Can a enum constructor be declared public in Java?

No. Enum constructor cannot be declared as public. The constructor for an enum type must be package-private or private access. It automatically creates the constants that are defined at the beginning of the enum body. You cannot invoke an enum constructor yourself.

More Related questions...

Show more question and Answers...


Comments & Discussions