-3
  package enum_movies;

   public enum Show_Day 
   {
        MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY;
   }
Jens
  • 67,715
  • 15
  • 98
  • 113
Ajeet Deginal
  • 241
  • 1
  • 2
  • 7

1 Answers1

1

Well, you don't have to. All the JLS requires is that there be an enum body with constants defined first, and it's legal for that body to only contain a semi-colon.

You could have an enum with all static methods in it like such...

public enum Baz {
    ;
    public static void evilLaugh() {
        System.out.println("BWAHAHA");
    }
}

...but what's the point of an enumeration if there are no values to enumerate over?

Makoto
  • 104,088
  • 27
  • 192
  • 230
  • my concern is only about, why constants has to be in first line!? why not any member at first line n later I will declare the constants? why the syntax is made like that? – Ajeet Deginal Oct 13 '14 at 05:04
  • ...Because the language specification said so. I believe I provided a link to the specific specification in my answer too... – Makoto Oct 13 '14 at 05:17