Compiler Error J0058

Cannot have a variable of type 'void'

The compiler detected a variable declared as type void. The keyword void is not allowed in variable declarations. Rather, void can only be used as a method return type, noting that the method does not actually return a value.

The following example illustrates this error:

public interface Simple {
   
   public final static void i = 1; 
   // error: 'void' not valid
}