#36 StringBuffer and StringBuilder in Java

preview_player
Показать описание
Check out our courses:

Coupon: TELUSKO10 (10% Discount)

Coupon: TELUSKO20 (20% Discount)

Udemy Courses:

For More Queries WhatsApp or Call on : +919008963671

In this lecture we are discussing about:
1)StringBuffer class and StringBuilder class
2)Different method of thes class
a)capacity()
b)length()
c)append()
d)insert()
e)deleteCharAt()
f)convert to String -- toString()
and there are many method you should explore from your side
3)Difference Between StringBuilder vs StringBuffer

#1
StringBuffer class and StringBuilder class
-- string buffer and string builder class in java used to create mutable string

#2
Different method
--First Create StringBuffer object
StringBuffer sb = new StringBuffer("Hello");
--Find capacity of StringBuffer
-- default capacity is 16

--Find the length of StringBuffer Created String

--To append the content in existing StringBuffer object

--To Convert StringBuffer Object into String Object

-- Delete charcter of particular index
-- delete character at index 3

-- Insert "hi " at index 0 of existingStringBuffer Object

#3
Difference between StringBuffer and StringBuilder
-- StringBuffer is thread safe
-- StringBuilder is not thread safe
Imp: We will discuss thread safe when we study multithreading

More Learning :

Donation:
PayPal Id : navinreddy20
Рекомендации по теме
Комментарии
Автор

the whole point of this video should've been explaining why and when to use StringBuffer and how it is thread safe - with an example.

sumitwadhwa
Автор

Imagine Navin sir conducting interview and the interviewe answering everything by watching his videos😅 sir be like Bro your are in😝

sanjanayamsani
Автор

Thank You so much Navin sir for this awesome lecture!!!

stunner
Автор

i love to do like add delete insert and index no nut i think u need to explain some more like this

mvvphfj
Автор

any new string you create for str. gives me error
Multiple markers at this line

- str cannot be resolved to a variable

- Syntax error on token ":", invalid
AssignmentOperator

davidsingh-ybyp
Автор

Is string builder obsolete because string buffer is same as string builder and also threadsafe?

abhisheksainani
Автор

when i type (str: "navin"); it says str cannot be resolved to a varriable

davidsingh-ybyp
Автор

what do bibliotecas i need to import first

petarmarcinko
Автор

Sir at beginning u told stringbuffer will have capacity 16, what if we assign a string length greater than 16??

manojs
Автор

Why are you not updating VS Code? Please update VS Code.

puruagni
Автор

Sir is this playlist enough to learn java completey?

SR
Автор

What if we use append for String as same as like StringBuffer

Now String can be mutable right?
We can append to String also using append()

So how to verify that now ?

kirank
Автор

public class Main{
public static void main(String[] args) {

String word = "Hello";
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(word);
stringBuffer.insert(0, "Howdy ");
stringBuffer.append(" Hi");






StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(word);
stringBuilder.insert(0, "Howdy ");
stringBuilder.append(" Hi");





}
}

kvelez
Автор

Hello Sir,

public class Test {

public static void main(String[] args) {

StringBuffer sb = new StringBuffer("Hello");
sb.append(" World");
System.out.println(sb);

}
}

Why I'm getting the capacity as 21 instead of 27?

vasanthapriyaponmudi
Автор

bro you're still learning while making the video tf

legendleg
Автор

Why would anyone in right mind use VS code for java

Innainna