Creating an array of concrete instances of a generic class

前端 未结 1 558
小鲜肉
小鲜肉 2021-01-25 05:27

I have a generic class Position and a concrete class Card. How do I create an array of type Position?

I tried

1条回答
  •  一个人的身影
    2021-01-25 06:04

    Use the raw type to create the array:

    Position[] suitPositions = new Position[5];
    

    0 讨论(0)
提交回复
热议问题