接口
结论 接口中的成员都是公共的权限。
实例
//创建一个接口
interface Demo {
public static final double PI = 3.14;
public abstract void show();
}
//创建类来实现接口
class DemoEmpl implements Demo {
public void show() {
System.out.println("yyy");
}
//实现
public class InterfaceDemo {
public static void main(String[] args) {
DemoEmpl e = new DemoEmpl();
e.show();
System.out.println(e.PI);
System.out.println();
}
}