Why can't I have 'int' as the type of an ArrayList?

前端 未结 7 712
时光取名叫无心
时光取名叫无心 2020-12-05 06:17

I want to declare an ArrayList of type int.

Why does the following give me an error:

ArrayList list1 = new Array         


        
相关标签:
7条回答
  • 2020-12-05 07:21

    int is a primitive. It is not a Object.

    Refer this link for further details.

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