Why am I not getting compile error when initializing an instance variable in an interface in java
So here is the interface code. I searched the internet if you can have an instance variable in the interface and I found out that I couldn't, but when I tried to initialize the instance variable in the interface I didn't get a compile time error.
public interface hgf {
public void eat();
int x = 0;
}
+3
source to share