Java Code Reorder Hard +35 XP
Builder Pattern
Arrange the builder pattern call correctly.
Click lines in the correct order
Available lines4 left
Your order
Click lines above to build your solution.
Show answer and explanation
Answer: User user = new User.Builder("Alice")
.email("alice@b.com")
.age(30)
.build();
Builder starts with the required field in the constructor, then chained optional setters, then build() at the end.
Hint: build() always comes last.
What this challenge tests
Code Reorder in Java: builder-pattern, design-patterns.