public static void main(String[] args) { List<?> list = new ArrayList<String>(); list.add(""); // 报错
}
请高手赐教,这个list要怎么添加元素。(或者说List<?>有什么用?)
感激不尽!
明白了,非常感谢!
明白了,非常感谢!
引用原文:
In fact, since you don't know what the ArrayList is supposed to contain, you can't add anything to the ArrayList
List<?>=泛型集合