Skip to content

Instantly share code, notes, and snippets.

@adam-arold
Created September 11, 2017 16:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adam-arold/12b7888d78ddda93144aebddac1d779e to your computer and use it in GitHub Desktop.
Save adam-arold/12b7888d78ddda93144aebddac1d779e to your computer and use it in GitHub Desktop.
Java user
public class JavaUser {
private final String name;
private final int age;
public String toHumanReadableFormat() {
return "JavaUser{" +
"name='" + name + '\'' +
", age=" + age +
'}';
}
public String toHumanReadableFormatWithStringFormat() {
return String.format("JavaUser{name='%s', age=%s}", name, age);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment