1.关于接口类型的数组
1 package test;
2
3 interface I {}
4
5 class C
implements I{}
6
7 public class ArrayTest {
8
9 public static void main(String[] args) {
10
11 // 是可以编译通过的,数组里存放的其实是对象的地址,而不是对象本身
12 // 其实这个数组里面存的引用都是指向null
13 I[] i =
new I[5
];
14
15 // 如何初始化
16 i[0] =
new C();
17 i[1] =
new C();
18
19 }
20
21 }
转载于:https://www.cnblogs.com/billmiao/p/9872192.html
转载请注明原文地址: https://win8.8miu.com/read-1552733.html