public abstract interface Color
{
public static final float[] xyz2sRGB;
static
{
float[] arrayOfFloat = new float[9];
arrayOfFloat[0] = 3.241F;
arrayOfFloat[1] = -0.9692F;
arrayOfFloat[2] = 0.0556F;
arrayOfFloat[3] = -1.5374F;
arrayOfFloat[4] = 1.876F;
arrayOfFloat[5] = -0.204F;
arrayOfFloat[6] = -0.4986F;
arrayOfFloat[7] = 0.0416F;
arrayOfFloat[8] = 1.057F;
xyz2sRGB = arrayOfFloat;
}
The compiler doesn’t like the above code, returning the error:
The interface ColorSpace cannot define an initializer
Where am I going wrong?
There is no initializer for interface. static or not. However, you can create an abstract class with static initializer. But remember that abstract class is not an interface, so you can only extend one such class.