What is the best standard style for a toString implementation? [closed]

I think the format produced by Guava’s MoreObjects.toStringHelper() is pretty nice, but it’s mainly just good to have some consistent format that you use:

public String toString() {
  return Objects.toStringHelper(this)
      .add("prop1", prop1)
      .add("prop2", prop2)
      .toString();
}

// Produces "SimpleClassName{prop1=foo, prop2=bar}"

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)