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”);
s.setCharAt(9,’l’);
SOP(s);
2) append():- appends the second string in first string.
str1.append(str2);
StringBuffer str1=new StringBuffer(“technicalicode”);
StringBuffer str2=new StringBuffer(“java”);
str1.append(str2);
SOP(str1);
str1 = technicalicodejava
3) Insert()
str1.insert(n,str2);
StringBuffer str1=new StringBuffer(“technicalicode”);
StringBuffer str2=new StringBuffer(“java”);
str1.insert(4,str2);
str1=
techjavanicalicode
4) setLength()
StringBuffer str1=new StringBuffer(“technicalicode”);
str1.setLength(18);
In questa pagina del sito puoi guardare il video online Intoduction of StringBuffer In Java | StringBuffer Methods | setCharAt | append | Insert | setLength della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Technical Icode 30 agosto 2023, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 25 volte e gli è piaciuto 1 spettatori. Buona visione!