Summary

In this chapter, you learned about how the enums in Java 5 introduced type safety to constants. We covered how each enum constant can have its own distinct state and behavior, not just what is common to all enum constants. However, it's not feasible to access the state and behavior that is specific to an enum constant with the existing enums.

Next, we covered how the enhanced enums can use generics and access a constant specific state and behavior. With examples, we also covered how type parameters facilitate sharper typing of enum constants.

In the next chapter, we'll cover how the data classes in Project Amber are bringing about language changes to define data carrier classes.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.32.67