Lab05 - Introduction To Strings
Lab05 - Introduction To Strings
Objective/s:
Introduction to Strings
Types of String Functions
Examples
Lab Tasks
1. Introduction to Strings
Strings are used for storing text. A String variable contains a collection of characters surrounded
by double quotes:
A String in Java is actually an object, which contain methods that can perform certain operations
on strings. For example, the length of a string can be found with the length() method:
1
BSSE – 5th Semester Software Construction & Development Fall 2023
There are many string methods available, for example toUpperCase() and toLowerCase():
The indexOf() method returns the index (the position) of the first occurrence of a specified text
in a string (including whitespace):
The String class has a set of built-in methods that you can use on strings.
2
BSSE – 5th Semester Software Construction & Development Fall 2023
3
BSSE – 5th Semester Software Construction & Development Fall 2023
4
BSSE – 5th Semester Software Construction & Development Fall 2023
a specified string
2. Tasks
1. Create a class in JAVA implementing all the above explained String functions.