Unit VI String
Unit VI String
Unit VI String
6.1 Discuss the concept of string.
6.2 Construct string.
6.3 Describe string buffer and String builder class.
6.4 Elaborate string buffer method: append(), reverse(),
delete(),insert() methods.
6.5 Describe concept of string length.
6.6 Experiment the concatenate strings.
String buffer: string buffer type object has provision to change the
length. Change is maintained in the same object. It is advanced approach
of programming.
m.delete(3,5);
It will return as comer
4. insert( );
This function allows you to insert a string at specified index into the
another string.
Syntax: stringBuffer variable1.insert(stringBuffer variable2);
String a="manish";
String b="bhanja";
}
// A sample program to illustrate various String manipulation2 in
java.
Note: compareTo:
Returns: negative if a<b
Positive if a>b
Zero if a=b
String a="Manish";
String b="Ojha";
}
Probable questions.
1. Define string.
2. List any four stringBuffer method.
3. Write a program to reverse the string “I am Manish”.
4. Write a program to concatenated two strings.