Created
September 11, 2017 16:26
-
-
Save adam-arold/12b7888d78ddda93144aebddac1d779e to your computer and use it in GitHub Desktop.
Java user
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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