Closed jurchiks closed 4 years ago
This comparison survey states: Enums do not support constructors. (Or rather, the constructor is private, so you cannot pass parameters to it.)
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.
public enum Planet
This is a huge oversight.
Hm. Looks like I misread the other tutorial I was reading.
I have corrected it. Thanks.
You missed the Summary table.
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.