Cannot invoke toString() on the primitive type int

后端 未结 6 1900
谎友^
谎友^ 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:09

    Primitive types (int, double, byte etc..) can't have methods. So use this :

    String itemId = String.valueOf(item.getId());
    

提交回复
热议问题