Whats the use of saying <? extends SomeObject> instead of

后端 未结 5 1771
陌清茗
陌清茗 2020-11-27 18:54

So I was looking over some Java code and stumbled upon:

List l;

basically this list accepts all objects that ar

5条回答
  •  醉话见心
    2020-11-27 19:43

    List l; is not accepting new SomeObject() but List l; does.

    what is also not working: List l = new ArrayList()

    what is working: List l = new ArrayList()

提交回复
热议问题