Possible Duplicate:
Why no static methods in Interfaces, but static fields and inner classes OK?
I want to know that why interface do not allow static block, but they allow to declare static variable. What if i want to intialize a static variable on some logic.
edit: Earlier i did not post my query in better form but this is my query with sample code. please look into it.
interface A {
static class XYZ {
public static void methodA() {
// some implementation
System.out.println("methodA");
}
public static void methodB() {
// some more implementation
System.out.println("methodB");
}
}
void methodC();
}
public class ABC implements A {
public static void main(String[] args) {
A.XYZ.methodA();
}
@Override
public void methodC() {
// TODO Auto-generated method stub
}
}
Since purpose of interface is to provide a mechanism where users/implementors of the interface can implement the properties( methods) according to their needs. But if i am allowed to add implementation in interface then some how that purpose of interface is defeated, please make me clear why this implementation in the interface is permitted, there must be something that is why and what is that fact, that is what i want to know