filmov
tv
Intoduction of StringBuffer In Java | StringBuffer Methods | setCharAt | append | Insert | setLength

Показать описание
In this video, I have explained the a very important topic which is StringBuffer in Java
String = immutable(string can’t be changeable)
StringBuffer= mutable(string can be changeable /length= increase/decrease)
String s1 = new String();
stringBuffer s2 = new StringBuffer();
Functions of StringBuffer():-
1) setCharAt(n,’character’):- this function replaces nth index with given character.
StringBuffer s=new StringBuffer(“technicalicode”);
SOP(s);
2) append():- appends the second string in first string.
StringBuffer str1=new StringBuffer(“technicalicode”);
StringBuffer str2=new StringBuffer(“java”);
SOP(str1);
str1 = technicalicodejava
3) Insert()
StringBuffer str1=new StringBuffer(“technicalicode”);
StringBuffer str2=new StringBuffer(“java”);
str1=
techjavanicalicode
4) setLength()
StringBuffer str1=new StringBuffer(“technicalicode”);
String = immutable(string can’t be changeable)
StringBuffer= mutable(string can be changeable /length= increase/decrease)
String s1 = new String();
stringBuffer s2 = new StringBuffer();
Functions of StringBuffer():-
1) setCharAt(n,’character’):- this function replaces nth index with given character.
StringBuffer s=new StringBuffer(“technicalicode”);
SOP(s);
2) append():- appends the second string in first string.
StringBuffer str1=new StringBuffer(“technicalicode”);
StringBuffer str2=new StringBuffer(“java”);
SOP(str1);
str1 = technicalicodejava
3) Insert()
StringBuffer str1=new StringBuffer(“technicalicode”);
StringBuffer str2=new StringBuffer(“java”);
str1=
techjavanicalicode
4) setLength()
StringBuffer str1=new StringBuffer(“technicalicode”);