Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java enums do support constructors with parameters #7

Closed
jurchiks opened this issue Jun 19, 2020 · 2 comments
Closed

Java enums do support constructors with parameters #7

jurchiks opened this issue Jun 19, 2020 · 2 comments

Comments

@jurchiks
Copy link

This comparison survey states: Enums do not support constructors. (Or rather, the constructor is private, so you cannot pass parameters to it.)

Official documentation disagrees: https://docs.oracle.com/javase/tutorial/java/javaOO/enum.html
Scroll down to public enum Planet, there is a constructor with parameters, which, naturally, can be overloaded.

This is a huge oversight.

@Crell
Copy link
Owner

Crell commented Jun 21, 2020

Hm. Looks like I misread the other tutorial I was reading.

I have corrected it. Thanks.

@Crell Crell closed this as completed Jun 21, 2020
@jurchiks
Copy link
Author

You missed the Summary table.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants