Cannot invoke toString() on the primitive type int

后端 未结 6 1893
谎友^
谎友^ 2021-02-07 11:31

Basically, what I\'m trying to do, is get the item ID, and set a price from a ini, basically like: itemid:price but, i cannot simply do item.getId().toString(). I\'m trying to g

6条回答
  •  不思量自难忘°
    2021-02-07 12:23

    Primitive types do not have methods, as they are not objects in Java. You should use the matching class:

    Integer.toString(item.getId());
    

提交回复
热议问题