A member of our study group pointed out the following.
The second example of page 62, showing an enum as in inner class does not compile. The Coffee object (defined on page 61) cannot see the enum, because it is an inner class:
To get it to compile, you can change Coffee to reference the enum in CoffeeeTest1? like
or, move Coffee into the CoffeeTest1 as a static inner class. It must be static.
[ April 03, 2007: Message edited by: MatthewTheNth Smith ]
posted 8 years ago
Yeah, if enum is public, it must be placed in an independent file, while enum definition can come under a class too.
This is the rule that in a file there can be at most one public class. So therefore if enum is public and not inside the class definition it must be kept in an independent file. Inside the class definition it can be private or protected or public. But independently only public can be used, no modifier default access as usually.