gpt4 book ai didi

java - 为什么我不能使用整数引用列表创建整数数组列表的数组列表?

转载 作者:行者123 更新时间:2023-11-29 03:56:16 25 4
gpt4 key购买 nike

List<List<Integer>> sets = new ArrayList<ArrayList<Integer>>();

为什么上面给出了编译器错误,为什么我不能在这里使用通用列表引用,为什么我需要让它成为特定的数组列表引用?

最佳答案

要编译它,您需要:

List<? extends List<Integer>> sets = new ArrayList<ArrayList<Integer>>();

List<List<Integer>> sets = new ArrayList<List<Integer>>();

关于java - 为什么我不能使用整数引用列表创建整数数组列表的数组列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6244903/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com