007-002-012
Object Creation: Method Chaining
Hard
Problem Description
Object Creation: Method Chaining
Learning Objective: Implement method chaining using methods that return this
Overview
Implement a fluent API using method chaining.
Specifications
- Create a
Builderclass - Define String
nameand intvaluefields - Define setName() and setValue() methods (return this)
- Define build() method that returns result as string
- Call using method chaining and output result
Output Format
Result: Test - 42
Ready to Try Running Code?
Log in to access the code editor and execute your solutions for this problem.
Don't have an account?
