#36 StringBuffer and StringBuilder in Java

  Рет қаралды 238,502

Telusko

Telusko

Күн бұрын

Пікірлер: 38
@sumitwadhwa8823
@sumitwadhwa8823 9 ай бұрын
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.
@sanjanayamsani8695
@sanjanayamsani8695 Жыл бұрын
Imagine Navin sir conducting interview and the interviewe answering everything by watching his videos😅 sir be like Bro your are in😝
@spoorthidi5544
@spoorthidi5544 8 ай бұрын
Yeah😂
@jethalalgada-p9r
@jethalalgada-p9r 2 ай бұрын
The default capacity of a StringBuffer object in Java is 16 characters, not 16 bytes. Each character in a StringBuffer is typically represented using 2 bytes (16 bits) in UTF-16 encoding. Therefore, a StringBuffer with a capacity of 16 characters can hold up to 32 bytes of data. If you need to store more characters in a StringBuffer, it will automatically increase its capacity.
@neboeleyazer4186
@neboeleyazer4186 4 ай бұрын
Doubt: Why is the capacity of the String Buffer not extending after we appending a new string or char to the existing string buffer???
@7stunner
@7stunner 9 ай бұрын
Thank You so much Navin sir for this awesome lecture!!!
@savelokhosa6846
@savelokhosa6846 4 ай бұрын
You are the best Navin
@manojs6043
@manojs6043 Жыл бұрын
Sir at beginning u told stringbuffer will have capacity 16, what if we assign a string length greater than 16??
@sandeepkumarbrungi7574
@sandeepkumarbrungi7574 Жыл бұрын
it will add 16 which is inital capacity + "your string is greater than 16"... so now the capacity will be 16 + your string length.
@manojs6043
@manojs6043 Жыл бұрын
@@sandeepkumarbrungi7574 Thank you bro!
@gujjushanmukhasaipavankuma8983
@gujjushanmukhasaipavankuma8983 Жыл бұрын
if ur String is "TELUKOO" which is of size 7, so now it will add 7+16=23
@theyouthmedia9451
@theyouthmedia9451 Жыл бұрын
Thank you so Much Sir
@raviteja-u9u
@raviteja-u9u Жыл бұрын
i love to do like add delete insert and index no nut i think u need to explain some more like this
@davidsingh-yb9yp
@davidsingh-yb9yp Жыл бұрын
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-yb9yp
@davidsingh-yb9yp Жыл бұрын
when i type (str: "navin"); it says str cannot be resolved to a varriable
@d4ny664
@d4ny664 10 ай бұрын
Type just ("Navin"), without 'str:'
@umarmuzammil7332
@umarmuzammil7332 3 күн бұрын
lovely
@abhisheksainani
@abhisheksainani Жыл бұрын
Is string builder obsolete because string buffer is same as string builder and also threadsafe?
@Nischit-s2z
@Nischit-s2z 11 ай бұрын
Stringbuilder is fast but not threadsafe.... StringBuffer is slow but threadsafe..... It depends upon the use case..... So, yeah StringBuilder is not obsolete... It's the same with vector(slow but threadsafe)and arraylist ( fast but not threadsafe)
@kirank9959
@kirank9959 7 ай бұрын
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 ?
@benstokes3377
@benstokes3377 5 ай бұрын
The String class does not provide an append() method. Instead, if you need to manipulate or build strings dynamically, you should use StringBuffer or StringBuilder, which are mutable.
@rinadem5219
@rinadem5219 Жыл бұрын
amazing
@petarmarcinko2846
@petarmarcinko2846 10 ай бұрын
what do bibliotecas i need to import first
@benstokes3377
@benstokes3377 5 ай бұрын
java.lang.StringBuffer You dont need to import any bibilotecas first because the methods shown in the video are already predefined in the standard java library class.
@SR09947
@SR09947 Жыл бұрын
Sir is this playlist enough to learn java completey?
@Rob-J-BJJ
@Rob-J-BJJ Жыл бұрын
yes mam
@legendleg7353
@legendleg7353 7 ай бұрын
bro you're still learning while making the video tf
@puruagni1927
@puruagni1927 8 ай бұрын
Why are you not updating VS Code? Please update VS Code.
@vasanthapriyaponmudi2777
@vasanthapriyaponmudi2777 Жыл бұрын
Hello Sir, public class Test { public static void main(String[] args) { StringBuffer sb = new StringBuffer("Hello"); sb.append(" World"); System.out.println(sb); System.out.println(sb.capacity()); } } Why I'm getting the capacity as 21 instead of 27?
@viksla7
@viksla7 Жыл бұрын
Have you tried by keeping the "Hello World" in StringBuffer Constructor?
@pankajdoodhwal5317
@pankajdoodhwal5317 Жыл бұрын
In the StringBuffer class, when appending to a string, the capacity will not change unless the length of the appended string exceeds the difference between the current capacity and the length of the string.
@KnowledgeAdda-y8e
@KnowledgeAdda-y8e 3 ай бұрын
Hellosir if I doing your join chanel then you get me extra benifit
@kvelez
@kvelez Жыл бұрын
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"); System.out.println(stringBuffer.toString()); System.out.println(stringBuffer.capacity()); System.out.println(stringBuffer.length()); System.out.println();//Division StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(word); stringBuilder.insert(0, "Howdy "); stringBuilder.append(" Hi"); System.out.println(stringBuilder.toString()); System.out.println(stringBuilder.capacity()); System.out.println(stringBuilder.length()); } }
@mounishfanofteluguguyyt
@mounishfanofteluguguyyt 6 ай бұрын
Bro you are a telugu guy
@Innainna976
@Innainna976 Жыл бұрын
Why would anyone in right mind use VS code for java
@benstokes3377
@benstokes3377 5 ай бұрын
its simply superior
@narrativegatherer3128
@narrativegatherer3128 5 ай бұрын
What is niqqa mumbling?
@रितुलमिश्रा
@रितुलमिश्रा 2 ай бұрын
JAVA REDDY 😂
#37 Static Variable in Java
7:06
Telusko
Рет қаралды 192 М.
#35 Mutable vs Immutable String in Java
6:23
Telusko
Рет қаралды 162 М.
Enceinte et en Bazard: Les Chroniques du Nettoyage ! 🚽✨
00:21
Two More French
Рет қаралды 42 МЛН
The Best Band 😅 #toshleh #viralshort
00:11
Toshleh
Рет қаралды 22 МЛН
#40 Encapsulation in Java
11:42
Telusko
Рет қаралды 222 М.
#95 Comparator vs Comparable in Java
15:43
Telusko
Рет қаралды 224 М.
Difference between String and StringBuffer
3:14
The Exam Central
Рет қаралды 609
Java Strings are Immutable - Here's What That Actually Means
7:06
Coding with John
Рет қаралды 627 М.
#26 Stack And Heap in Java
12:37
Telusko
Рет қаралды 308 М.
#83 User Input using BufferedReader and Scanner in Java
11:48
#51 This and Super Method in Java
12:11
Telusko
Рет қаралды 141 М.
#53 Packages in Java
12:20
Telusko
Рет қаралды 249 М.
#58 Object Class equals toString hashcode in Java
12:00
Telusko
Рет қаралды 138 М.