我是java新手并试图理解接口。制作没有方法的接口会产生编译时错误。这种行为的原因是什么?
import java.io.*;
interface A{
int x=10;
}
class B implements A{
System.out.print("i am in B and x is"+x);
}
class InterfaceEx{
public static void main(String[] args) {
A a;
a=new B();
}
}