Java generics: List = new LinkedList>() is prohibited?

前端 未结 3 1587
迷失自我
迷失自我 2021-01-04 12:44

How come, in Java, I can write

List list = new LinkedList();

but not

List>          


        
3条回答
  •  孤街浪徒
    2021-01-04 13:13

    Edit: I was searching through Angelika Langer's FAQ for an explanation, but didn't find one (it's probably there, but hiding somewhere in the 500 pages).

    Thank you very much for the answer. I found an explanation in the FAQ, and after some squinting at it I think I get it.

    http://www.angelikalanger.com/GenericsFAQ/FAQSections/TypeArguments.html#What%20do%20multilevel%20wildcards%20mean?

提交回复
热议问题