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

前端 未结 7 736
时光取名叫无心
时光取名叫无心 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:11

    int is not an Object and hence if list type is int, implementations of the list cannot be done.

提交回复
热议问题