• Post Reply Bookmark Topic Watch Topic
  • New Topic

enum  RSS feed

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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) ?

file name coffeesize.java

 
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!