public class ArrayTest {
public static void main(String[] args)
{
I[] i = new I[2];//创建引用,并没有创建接口的实例
i[0] = new C(); //多态
i[1] = new C();
}
}
interface I
{
}
class C implements I
{
}
数组和接口的一个实例
最新推荐文章于 2022-07-11 18:48:51 发布
public class ArrayTest {
public static void main(String[] args)
{
I[] i = new I[2];//创建引用,并没有创建接口的实例
i[0] = new C(); //多态
i[1] = new C();
}
}
interface I
{
}
class C implements I
{
}