013-002-010

Using String Methods

Easy

Problem Description

Using String Methods

In this problem, you will create a program that reads a string from standard input, applies toUpperCase(), toLowerCase(), substring(), and charAt() methods to it, and displays the results.

Learning Objective: Understand and use basic String class methods

Overview

Java's String class provides many useful methods for string manipulation including toUpperCase(), toLowerCase(), substring(), and charAt().

Specifications

  • Read one line of text from standard input (assume at least 8 characters)
  • Perform and display: uppercase conversion, lowercase conversion, substring extraction (indices 0–4), character at position 7

Input Format

A string (at least 8 characters)

Output Format

Original: <input string>
Upper: <uppercase>
Lower: <lowercase>
Substring(0,5): <substring>
CharAt(7): <character at index 7>

Sample Input/Output

Input:
Hello, World!

Output:
Original: Hello, World!
Upper: HELLO, WORLD!
Lower: hello, world!
Substring(0,5): Hello
CharAt(7): W

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