{ // Example 1: Creating a user in a single line UserProfile user1 = new UserProfileBuilder("alice123") .email("[email protected]") .phoneNumber("555-1234") .address("123 Main St, NY") .age(25) .build(); // Example 2: Building the object step by step UserProfileBuilder builder = new UserProfileBuilder("bob456"); builder.email("[email protected]").phoneNumber("555-5678"); UserProfile user2 = builder.address("456 Elm St, LA").age(30).build(); System.out.println(user1); System.out.println(user2); } } 7
Foo -|> Bar @enduml Always the first lines. Always the last line class interface abstract class <|-- extends <|.. realization *— composition o-- aggregation --> association ..>. dependency
[email protected] Summer 2025 Copyright. These slides can only be used as study material for the class CSC305 at Cal Poly. They cannot be distributed or used for another purpose.