Skip to main content
1 of 2
Gerold Broser
  • 1.3k
  • 8
  • 20

I'd use:

return String.format("%s %s", this.name, this.freshness);

instead of string concatenation:

return this.name + " " + this.freshness + "\n";

for clearness. I'd also omit "\n" since it's up to the caller whether he or she wants a line break. If he or she does not want one they are fighting a losing battle with your implementation imposing one.

Gerold Broser
  • 1.3k
  • 8
  • 20