In the Beginning of the Beginning, There was Beginning...Wait What??!!
Numbers...Everywhere is Numbers
Collecting key notes about enum
enums are implicitly final subclasses of java.lang.Enum if an enum is a member of a class, it’s implicitly static new can never be used with an enum, even within the enum type itself name and valueOf simply use the text of the enum constants, while toString may be overridden to provide any content, if desired for enum constants, equals and == amount to the same thing, and can be used interchangeably enum constants are implicitly public static final the order of appearance of enum constants is called their “natural order”, and defines the order used by other items as well : compareTo, iteration order of values , EnumSet, EnumSet.range. Constructors for an enum type should be declared as private. The compiler allows non private declares for constructors, but this seems misleading to the reader, since new can never be used with enum types.
Since these enumeration instances are all effectively singletons, they can be compared for equality using identity (“==”). you can use Enum in Java inside Switch statement like int or char primitive data type
Campbell Ritchie wrote:I still think the Java™ Tutorials link I gave you yesterday is the best enum tutorial to date. You will see at least two of the tutorials says, “more powerful”. That is something important to remember. Because an enum constant is a full‑blown object/instance of its class, with methods and all. The Java Tutorials link shows you how to calculate weights on different planets with an enum.
Sankalp Bhagat wrote:then what is given in your link you think is the best tutorial to date?
Sankalp Bhagat wrote:In every post you reply and what makes you think yours answer is the best of all?
salvin francis wrote:Sankalp you need to cool down a bit. Campbell Ritchie is here since years helping out folks voluntarily. Infact, we are all volunteers here. We go out of our current work tasks and find out stuff to help out people in coding.
You have pointed out a lot of stuff that you feel is missing out in the tutorial link and you have the right to ask:
Sankalp Bhagat wrote:then what is given in your link you think is the best tutorial to date?
But, I find a line in our post very rude and personal:
Sankalp Bhagat wrote:In every post you reply and what makes you think yours answer is the best of all?
Consider Paul's rocket mass heater. |