Creating an array of concrete instances of a generic class

前端 未结 1 534
小鲜肉
小鲜肉 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<String>[] suitPositions = new Position[5];
    
    0 讨论(0)
提交回复
热议问题