0% found this document useful (0 votes)
4 views

Pratik String Buffer

ye bhi hai

Uploaded by

riteshdebadwar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Pratik String Buffer

ye bhi hai

Uploaded by

riteshdebadwar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Gramin Technical and Management Campus

Department of Computer Engineering


Subject/code : JAVA/22412

NAME : Pratik Yeluetwad Batch : B ROLL NO :07


AIM: Develop program for implementation of different functions of String
class, part-1 and part 2

Code:

public class StringB


{
public static void main(String[] args)
{
StringBuffer s1 = new StringBuffer("Hello");
System.out.println("Original String: " + s1);
s1.append(" Pranav");
System.out.println("Append: " + s1);
s1.delete(6, 12);
System.out.println("Deleting characters from 6 to 11: " + s1);
s1.insert(5, " Java");
System.out.println("Inserting at position 5: " + s1);
System.out.println("charAt : " + s1.charAt(3));
System.out.println("Substring : " + s1.substring(0,4));
System.out.println("deleteCharAt : " + s1.deleteCharAt(8));
s1.reverse();
System.out.println("Rversing: " + s1);
System.out.println("length : " + s1.length());

StringBuffer s2 = new StringBuffer("Pranai");


System.out.println("String replace : " + s2.replace(5,6,"v"));
int cap = s2.capacity();

System.out.println("Capacity : " + cap);


}
}
Output:

You might also like