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

Publicado em: 30 Agosto 2023
no canal de: Technical Icode
25
1

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);


Nesta página do site você pode assistir ao vídeo on-line Intoduction of StringBuffer In Java | StringBuffer Methods | setCharAt | append | Insert | setLength duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Technical Icode 30 Agosto 2023, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 25 vezes e gostou 1 espectadores. Boa visualização!