Cannot invoke toString() on the primitive type int

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

Integer.toString(item.getId());

Leave a Comment