The Complete Java Enums Tutorial with Examples - JavaBrahman
All enum types are classes. When an enum type is compiled, then behind the scenes the compiler inserts a lot of boilerplate code which gives the enum type classes their 'special' nature. This boiler code provides features of a full blown class and object constants definitions based on just the enum definition. So, in effect the compiler is doing all the hard work involved in creating a type and its constants objects behind-the-scenes, and abstracting it all out as a simple enum type and constants definition. Thus, all a programmer needs to do is define a enum type and its constants, and the compiler does the rest automatically.
Read full article from The Complete Java Enums Tutorial with Examples - JavaBrahman
No comments:
Post a Comment