Skip to content

Instantly share code, notes, and snippets.

@viniciustavanoferreira
Created February 19, 2019 18:54
Show Gist options
  • Save viniciustavanoferreira/bbd79a938190b7740bb475dd6ba8d91c to your computer and use it in GitHub Desktop.
Save viniciustavanoferreira/bbd79a938190b7740bb475dd6ba8d91c to your computer and use it in GitHub Desktop.
public static void main(String[] args) {
User user1 = new User.UserBuilder("Lokesh", "Gupta")
.age(30)
.phone("1234567")
.address("Fake address 1234")
.build();
System.out.println(user1);
User user2 = new User.UserBuilder("Jack", "Reacher")
.age(40)
.phone("5655")
//no address
.build();
System.out.println(user2);
User user3 = new User.UserBuilder("Super", "Man")
//No age
//No phone
//no address
.build();
System.out.println(user3);
}
Output:
User: Lokesh, Gupta, 30, 1234567, Fake address 1234
User: Jack, Reacher, 40, 5655, null
User: Super, Man, 0, null, null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment