When a class containing the main method should be public to run along with the (public)class name should be the name of the .java file, why it isnt the same case for enum? Below code runs just fine?! Should the compiler complain about the name of the enum(CoffeeSize) not being same as name of the .java file (coffeesize.java) ?
You did not declare this enum as public, so its file name does not have to match its class name. Also, if you're on Windows, the file system may be case-insensitive, which may allow some things to work fine regardless of case, and then other case-sensitive things will break later.