It is optional to put a semicolon at the end of the enum declaration : enum « Object Oriented « SCJP






public class MainClass {

  enum Problem { BIG, HUGE, SMALL }; // <--semicolon is optional here
  public static void main(String[] args) {

  }
}








6.11.enum
6.11.1.Java enum
6.11.2.Declaring Enums
6.11.3.An example of declaring an enum inside a class
6.11.4.You cannot declare enums in a method
6.11.5.It is optional to put a semicolon at the end of the enum declaration
6.11.6.Declaring Constructors, Methods, and Variables in an enum
6.11.7.Enums are subclasses of java.lang.Enum.
6.11.8.You can declare an enum anywhere you can declare a class.
6.11.9.Enums inherit data and methods from Object.
6.11.10.Enums may be converted and cast according to the same rules that govern any class that extends Object.
6.11.11.Enums may have main() methods and can be invoked as applications.
6.11.12.Enums that have no explicit constructors get default no-args constructors.
6.11.13.Enums have built-in name() and toString() methods, both of which return the name of the current instance.
6.11.14.You can add data, methods, and constructors to an enum.