Java Strings- Advanced Methods & Manipulations
Java Strings- Advanced Methods & Manipulations
Manipulations
Session No.:
Course Name: OOPS using Java
Course Code: R1UC201C
Instructor Name: Rani Singh
Duration: 50 minutes
Date of Conduction of Class:
Galgotias University 1
Revision
Reflect
• What on the
will be the output of the following?
responses of
1. post session 2
activity
Galgotias University 2
Opening Question
Reflect on the
"Weresponses
know that of String objects in
Java are immutable.
So post
whatsession
if we need to modify astring multiple times
activity
(e.g., appending, inserting, or deleting characters)?
What class can we use to handle such situations
efficiently?"
Galgotias University 3
SESSION OUTLINE
ACTIVITY 1
SYNTAX AND EXAMPLES
ACTIVITY 2
CONCLUSION
Galgotias University 4
At the end of this session students will be able to
LEARNING OUTCOME
Explain Java String Buffer and its methods
Galgotias University 5
Java String Buffer
Reflect on the
responses of
post session
activity
Galgotias University 6
Learning Activity 1 : THINK-PAIR SHARE
Think: • Students individually reflect on the difference between String and String
Buffer
Galgotias University 7
Learning Activity 1 : Reflection
Galgotias University 8
String Buffer Methods with Example
Galgotias University 9
String Buffer Methods with Example
Galgotias University 10
Learning Activity 1 : Hands-on- coding
Write a program understand the functionality and behavior of key StringBuffer methods
(append(), insert(), replace(), delete(), and reverse()) and compare them with how similar
tasks are handled using the immutable String class.
Galgotias University 11
Learning Activity 1 : Reflection
Galgotias University 12
Lets Conclude The session!!!!!!!!!!
Galgotias University 13
At the end of this session students will be able to
Galgotias University 14
15
Post-
Assessmen Modify the string "Java is fun and
powerful" to "Python is fun and
t powerful" using replace().
Questions
Demonstrate the effect of trim() on the
string " Java Programming ".
Open-Ended Questions
16