标签:ati [] void new oid over 父类 line code
类的对象赋给类所实现的接口的声明(把所实现的接口看做是“父类”):
public class TestInterface {
public static void main(String[] args) {
D d = new D();
TestInterface t = new TestInterface();
t.test1(d);// A a = new D();
}
public void test1(A a) {
}
}
interface A {
int I = 0;
void method();
}
class D implements A {
@Override
public void method() {
}
}
标签:ati [] void new oid over 父类 line code
原文地址:http://www.cnblogs.com/chendifan/p/6535598.html