010-004-010
Method Chain and Overloading
Medium
Problem Description
method Chain and Overloading
In this problem, you will create a program that implements overloaded format methods — one that returns a string as-is and another that converts it to uppercase when the boolean flag is true — and displays the results to standard output.
Learning Objective: Understand flexible method design using overloading
Overview
Create a string formatter with multiple format options.
Specifications
- format(String text) method: returns as is
- format(String text, boolean uppercase) method: converts to uppercase if true
- Call both methods
Output Format
hello world
HELLO WORLD
Ready to Try Running Code?
Log in to access the code editor and execute your solutions for this problem.
Don't have an account?
Sign Up