Object.toString() is used for objects. String.valueOf(primitive) for primitives. String.valueOf(object) returns "null" if the object is null else object.toString()