EDIT: As of Java 8, static methods are now allowed in interfaces.
Here\'s the example:
public interface IXMLizable
To solve this : error: missing method body, or declare abstract static void main(String[] args);
interface I
{
int x=20;
void getValue();
static void main(String[] args){};//Put curly braces
}
class InterDemo implements I
{
public void getValue()
{
System.out.println(x);
}
public static void main(String[] args)
{
InterDemo i=new InterDemo();
i.getValue();
}
}
output : 20
Now we can use static method in interface