Java nested generic type mismatch

前端 未结 5 502
耶瑟儿~
耶瑟儿~ 2020-12-05 11:13

In the following example:

public static void main(String[] args) {

    List b = new ArrayList();
    first(b);
    second(b);

          


        
5条回答
  •  自闭症患者
    2020-12-05 11:34

    A List> isn't a List>.

    You should be able to put any List into a List>, no matter what the ?. A List> will only accept a List.

提交回复
热议问题