Module Overview
This module introduces string handling in Java and explains how text data is stored, accessed and manipulated within applications.
Learners will explore string creation, commonly used string methods, string comparison and concatenation.
The module also covers StringBuffer and StringBuilder, helping learners understand different approaches to working with and modifying text.
These concepts are useful when developing applications that process names, descriptions, messages, user inputs and other text-based information.
What Will Be Covered
5.1 String Introduction
Understanding what strings are in Java.
Exploring the String class.
Creating strings using string literals and the new keyword.
Understanding how strings are stored and accessed.
Exploring the concept of string immutability.
Working with string variables in Java programs.
5.2 String Methods
Understanding commonly used methods of the String class.
Finding the length of a string using length().
Extracting characters using charAt().
Extracting portions of text using substring().
Converting text using toUpperCase() and toLowerCase().
Removing leading and trailing spaces using trim().
Searching for text using contains(), indexOf() and startsWith().
Replacing characters or text using replace().
5.3 String Comparison
Understanding how strings are compared in Java.
Comparing string values using equals().
Performing case-insensitive comparisons using equalsIgnoreCase().
Understanding the difference between == and equals().
Comparing strings using compareTo().
Applying string comparison to validate and match text-based information.
5.4 String Concatenation
Understanding the purpose of string concatenation.
Combining strings using the + operator.
Using the concat() method.
Combining text with variables and other data types.
Creating formatted text output using concatenation.
Applying concatenation when generating messages and displaying application information.
5.5 StringBuffer
Understanding the purpose of the StringBuffer class.
Exploring mutable strings in Java.
Creating StringBuffer objects.
Appending text using append().
Inserting content using insert().
Replacing and deleting characters.
Understanding how StringBuffer supports modifications to existing text.
5.6 StringBuilder
Understanding the purpose of the StringBuilder class.
Creating and modifying StringBuilder objects.
Using append(), insert(), replace() and delete().
Understanding mutable string operations.
Exploring StringBuilder for repeated text modifications.
Applying StringBuilder when constructing and processing dynamic text.
5.7 Difference Between String, StringBuffer and StringBuilder
Understanding the characteristics of String, StringBuffer and StringBuilder.
Comparing immutable and mutable string objects.
Understanding how each class handles text modifications.
Exploring the differences in performance and usage.
Understanding the thread-safety characteristics of StringBuffer and StringBuilder.
Selecting the appropriate class based on application requirements.
Skills You Will Gain
Creating and managing string variables in Java.
Using built-in String methods to manipulate text.
Comparing strings and validating text values.
Combining multiple strings using concatenation.
Modifying text using StringBuffer.
Working with mutable strings using StringBuilder.
Understanding the differences between String, StringBuffer and StringBuilder.
Selecting suitable string-handling techniques for application development.
Processing text-based information within Java programs.
Learning Outcomes
By the end of this module, learners will be able to:
Store and manage text-based information such as customer names, product descriptions and user details.
Apply String methods to search, extract, modify and format text.
Compare string values to validate user inputs and match application records.
Combine text and variable values to generate meaningful application messages and outputs.
Use StringBuffer and StringBuilder when applications require repeated text modifications.
Select appropriate string classes based on performance, mutability and application requirements.
Develop Java programs that process and manage text-based business information effectively.
Certification Alignment
This module develops Java string handling and text manipulation knowledge that supports the broader learning pathway towards the Oracle Certified Professional: Java SE 17 Developer certification.
The concepts covered help learners understand string operations, object behaviour and text processing within Java applications.
Continue to the Next Module
Continue to Module 6: Classes and Objects to learn about classes, objects, attributes, methods, object creation and accessing class members in Java.
Still need help?
Contact us