Possible Duplicate:
Protected in Interfaces
The following code snippet shows that an interface in Java can have only one modifier which is public. No other modifiers (private and protected) are allowed within an interface neither with fields nor with any methods. Obviously among modifiers, private has no meaning to use within an interface but protected should be allowed within an interface because it can be incorporated by it's implementing class.
interface Demo
{
private final static int a=10; //Will not be compiled.
protected final static int b=20; //Will not be compiled.
public final static int x=0; //ok
abstract public void showSum();
}
while an abstract class is allowed to have all the modifiers private, public and protected. My question is only that a protected modifier is not allowed within an interface that somewhat seems to be allowed. Why?