Java ArrayList of ? extends Interface

前端 未结 4 1184
长情又很酷
长情又很酷 2020-12-12 02:13

I have a group of classes that all implement a validation interface which has the method isValid(). I want to put a group of objects--all of different classes--

4条回答
  •  一生所求
    2020-12-12 03:02

    The declaration ArrayList means a list of an unknown class that extends Validation. Email is not compatible with this unknown class.

    You can use ArrayList for your list.

提交回复
热议问题