Error of int cannot be dereferenced?

后端 未结 3 1467
面向向阳花
面向向阳花 2021-01-06 19:51

I am getting an error with this constructor, and i have no idea how to fix? I am a beginner at java. This is from an example exercise that i was trying to learn:

<         


        
3条回答
  •  既然无缘
    2021-01-06 20:10

    int is not an object in java (it's a primitive), so you cannot invoke methods on it.

    One simple way to solve it is using Integer.toString(intArray[i])

提交回复
热议问题