I have a question in my mind, Why can't be a member variable in Interface be a non constant.. The logic of being static stood right in my mind that if one needs to access the variable of Interface then it is must for it to be static as we cannot create the instance of the Interface but Why the need of final arises?? The below code shows how the interface member variables are made static final even though we dont mention it by default....
interface inter{
int a=10; // It becomes final static by default
public void interFunc();
}
class cls implements inter{
public void interFunc(){
System.out.println("In Class Method WITH a's Value as --> "+a);
}
}
class Test{
public static void main(String[] args){
inter in= new cls();
in.interFunc();
}
}
Thanks in advance !!!