Compiler Error J0138

Interface cannot have static or instance initializer

The compiler detected a static initializer or instance initializer within an interface. Because an interface does not get instantiated, initializers cannot be defined in an interface. To set the values of interface fields, initialize them at the time of declaration.

The following example illustrates this error:

interface Simple {
   int x = 10; //This is OK
   {
      // error: initializers cannot 
      // be used in interfaces
   }
}