Filter
Exclude
Time range
-
Near
Day-26 โœ… GFG Summer SkillUp - Java Completed: StringBuffer Class ๐ŸŽฏ๐Ÿ“ Link: geeksforgeeks.org/summer-skiโ€ฆ #GFG #skillupwithgfg #summerskillup
1
9
side hustle and weekend - understand the interface and its implementation - string in java and pooling immutability internals and methods, stringbuilder, stringbuffer - generics java using generics in methods classes and wildcard generics crazy wkds spend 12hr jay shree ram
1
2
92
I'm not sure I've seen a usecase for StringBuffer, where someone wants to append together the result of a string while also passing it around between multiple threads to do so. For most StringBuilder operations, you'd just do the for loop on 1 background thread, then toString().
1
16
Replying to @mario_casari
Careful though. StringBuilder is not thread safe. StringBuffer is. Though it is slower.
2
1
72
Discover how to use StringBuffer in Java for thread-safe string manipulation, with examples, performance tips, and best practices. nkamphoa.com/stringbuffer-inโ€ฆ
2
When using Java's `String` concatenation operator ( ), be aware that it creates a new object every time, whereas using `StringBuilder` or `StringBuffer` can reduce memory usage and improve performance in resource-constrained environments. #JavaTips
2
Replying to @BullTheoryio
I have a similarly sensational story of my own that I have never disclosed. There is a person living somewhere in eastern US. Letโ€™s just call him T. T apparently has an agreement with a large Wall St Bank. T goes to their office and stares at a screen. He also moves the mouse and types cryptic, nonsense things like StringBuffer() and ResultSet.next(). The Bank never explicitly discloses to anyone why T does this and what nefarious intentions are hiding behind it. In return, they pay T an undisclosed amounts of money, which they later disclose to IRS for some reason. T also discloses the same to IRS. Do you now see the problem with this double disclosure? Is anyone paying attention? Are retirees even notified of this? Now the dark part. What does T do with this money? There are multiple controversial ways this money is channeled, most not disclosed to anyone. But there are some clues we have gathered. Apparently, T has ties to another company named Costco. He sources an undisclosed amount of eggs from Costco. Costco has an opaque web of sourcing agreements with multiple shady operations up and down the Atlantic seaboard. For all we know, the eggs reaching T came from some farm in Pennsylvania that doesnโ€™t do any filing with SEC. This is something the average retiree has no insight into. Now, you might think T holds these eggs on his books. He doesnโ€™t. Through complex processes involving multiple layerings of condiments , digestive enzymes, and other methods, these eggs ultimately end up in a toilet made by a Japanese company named Toto. You might recall that this is the same company whose valuation is strangely tied to the whole AI thing. Do you now see the mysterious links between pennsylvania farmers and Elon Musk, with Wall St banks and T acting as dark intermediaries?

4
1,078
Why is StringBuffer usually faster than String inside loops? #JavaBasics
1
17
Replying to @Its_Nova1012
Java dev built different....for Vibe coding..... you need to know first....many just confused in stringbuilder or stringbuffer....
4
706
Discover how to use StringBuffer in Java for thread-safe string manipulation, with examples, performance tips, and best practices. nkamphoa.com/stringbuffer-inโ€ฆ
4
โ˜• Day 14 Java Series: Today we learn: ๐Ÿ”ฅ StringBuilder vs StringBuffer This topic exists because: ๐Ÿ‘‰ Strings in Java are immutable. --- # ๐ŸŽฏ Quick Revision Example: String s = "Hello"; s.concat(" World"); System.out.println(s); Output: Hello Why? Because Strings cannot be changed after creation. Instead: ๐Ÿ‘‰ Java creates a NEW object. --- # ๐ŸŽฏ Problem with Immutable Strings Example: String s = "Java"; s = s " Programming"; Every modification creates: ๐Ÿ‘‰ New object in memory. Too many modifications: โŒ More memory usage โŒ Slower performance This is why: ๐Ÿ‘‰ StringBuilder and StringBuffer exist. ([GeeksforGeeks][1]) --- # ๐Ÿ”น StringBuilder StringBuilder is mutable. Meaning: ๐Ÿ‘‰ Content can change without creating new objects. Example: StringBuilder sb = new StringBuilder("Hello"); sb.append(" World"); System.out.println(sb); Output: Hello World --- # ๐ŸŽฏ Why StringBuilder is Fast Because modifications happen in SAME object. No repeated object creation. This improves: โ€ข Performance โ€ข Memory efficiency --- # ๐Ÿ”น Common StringBuilder Methods append() โ†’ adds text insert() โ†’ inserts text delete() โ†’ removes characters reverse() โ†’ reverses string Example: StringBuilder sb = new StringBuilder("Java"); sb.reverse(); Output: avaJ --- # ๐Ÿ”น StringBuffer StringBuffer is also mutable. But: ๐Ÿ‘‰ It is synchronized / thread-safe. Meaning: Multiple threads can safely use it. Example: StringBuffer sb = new StringBuffer("Hello"); sb.append(" Java"); --- # ๐ŸŽฏ Important Difference StringBuilder โœ… Faster โŒ Not thread-safe StringBuffer โœ… Thread-safe โŒ Slightly slower ุจุณุจุจ synchronization Huge interview concept. --- # ๐Ÿ”น When to Use What? Use String: ๐Ÿ‘‰ Fixed text Use StringBuilder: ๐Ÿ‘‰ Frequent modifications in single-threaded apps Use StringBuffer: ๐Ÿ‘‰ Multi-threaded environments --- # ๐Ÿ“Š Performance Reality Example: String s = ""; for(int i = 0; i < 1000; i ) { s = i; } This creates MANY String objects. Instead: StringBuilder is much faster for repeated concatenation. --- # ๐ŸŽฏ Final Thought Strings are great for fixed data. StringBuilder/StringBuffer are better for changing data. Understanding mutability is a huge step toward advanced Java. Tomorrow: Methods in Java. #Java #Programming #Coding #Developers
1
16
โ˜• Day 13 Java Series: Today we learn: ๐Ÿ”ฅ Strings in Java Strings are one of the most important concepts in programming. Because almost every application works with text. Examples: โ€ข Names โ€ข Emails โ€ข Passwords โ€ข Messages โ€ข Search systems --- # ๐ŸŽฏ What is a String? A String is a sequence of characters. Example: String name = "Java"; Here: ๐Ÿ‘‰ "Java" is a String. In Java, String is actually an object of the String class. ([igmguru][1]) --- # ๐Ÿ”น Creating Strings There are 2 common ways: ## 1. String Literal String s1 = "Hello"; Stored inside: ๐Ÿ‘‰ String Constant Pool. ([GeeksforGeeks][2]) --- ## 2. Using new Keyword String s2 = new String("Hello"); This creates a new object in heap memory. ([Medium][3]) --- # ๐ŸŽฏ Important Concept Java optimizes memory using: ๐Ÿ‘‰ String Pool Example: String a = "Java"; String b = "Java"; Both references point to same object in pool. ([GeeksforGeeks][2]) Huge interview concept. --- # ๐Ÿ”น String Immutability Strings in Java are immutable. Meaning: ๐Ÿ‘‰ Once created, they cannot be changed. ([GeeksforGeeks][4]) Example: String s = "Hello"; s.concat(" World"); System.out.println(s); Output: Hello Because concat() creates a new String object. ([GeeksforGeeks][5]) --- # ๐Ÿ”น Common String Methods ## length() Returns total characters. Example: String text = "Java"; System.out.println(text.length()); Output: 4 --- ## charAt() Returns character at index. Example: text.charAt(1); Output: a --- ## toUpperCase() Converts to uppercase. Example: text.toUpperCase(); Output: JAVA --- ## toLowerCase() Converts to lowercase. --- ## equals() Compares content. Example: String a = "Java"; String b = "Java"; System.out.println(a.equals(b)); Output: true Important: ๐Ÿ‘‰ equals() compares values ๐Ÿ‘‰ == compares references Huge beginner mistake. --- ## contains() Checks if substring exists. Example: text.contains("av"); Output: true --- ## substring() Extracts part of string. Example: text.substring(1,3); Output: av --- # ๐ŸŽฏ Why Strings matter Strings are heavily used in: โ€ข APIs โ€ข Databases โ€ข Web applications โ€ข Authentication systems โ€ข Search engines --- ๐Ÿ“Š Important Reality: Strings are immutable because it improves: โ€ข Security โ€ข Thread safety โ€ข Memory optimization using String Pool. ([Medium][6]) --- ๐ŸŽฏ Final thought: If you master Strings, you become much stronger in programming interviews and backend development. Tomorrow: StringBuilder and StringBuffer. #Java #Programming #Coding #Developers
1
23
String immutability still remains a probable question in the interviews. Add to it StringBuffer and StringBuilder == and hashCode() along with .equals() comparison.
1
33
#day26 today understand all about String, StringBuilder & StringBuffer all methods how it execute one important point StringBuilder & StringBuffer not override Equals Methods Thanks Rohit & Aditya Bhaiya๐Ÿ™๐Ÿป @CoderArmy @rohit_negi9 @adityatandon02 @java
1
4
43
Strings bas ek topic nahi hai, yeh interviews ka favorite hai. Agar tum sirf methods yaad kar rahe ho, to problem wahi hai. Concept samajh jaoge, to sab easy ho jayega. ๐’๐ญ๐ซ๐ข๐ง๐  ๐ฏ๐ฌ ๐’๐ญ๐ซ๐ข๐ง๐ ๐๐ฎ๐ข๐ฅ๐๐ž๐ซ ๐ฏ๐ฌ ๐’๐ญ๐ซ๐ข๐ง๐ ๐๐ฎ๐Ÿ๐Ÿ๐ž๐ซ Save & Share๐Ÿš€ #Java #DSA
1
3
36
Java Interview Questions: 1. What is Java, and what are its key features? 2. What is the difference between JDK, JRE, and JVM? 3. Explain the concept of object-oriented programming (OOP) in Java. 4. What are the main principles of OOP (Encapsulation, Inheritance, Polymorphism, Abstraction)? 5. What is the difference between an abstract class and an interface? 6. What is method overloading vs method overriding? 7. What is the difference between == and equals() in Java? 8. What is the difference between String, StringBuilder, and StringBuffer? 9. What is garbage collection in Java, and how does it work? 10. What are Java memory areas (Heap, Stack, Method Area)? 11. What is the difference between checked and unchecked exceptions? 12. What is exception handling in Java (try, catch, finally)? 13. What are Java Collections, and what are the main interfaces? 14. What is the difference between ArrayList and LinkedList? 15. What is the difference between HashMap and HashSet? 16. What is multithreading in Java? 17. What is the difference between Thread and Runnable? 18. What is synchronization in Java? 19. What are deadlocks, and how can you prevent them? 20. What is the volatile keyword in Java? 21. What is the difference between process and thread? 22. What is Java Stream API? 23. What are lambda expressions in Java? 24. What is functional programming in Java? 25. What is JDBC, and how do you connect to a database? 26. What is Hibernate, and how does it work? 27. What is Spring Framework? 28. What is Spring Boot, and why is it used? 29. What is REST API development in Java? 30. How do you secure a Java application? Grab the Java Ebook: codewithdhanian.gumroad.com/โ€ฆ
1
36
144
3,806
Compare StringBuilder vs StringBuffer in Java. Learn key differences, performance, thread safety, and best use cases with examples. nkamphoa.com/stringbuilder-vโ€ฆ
1
I almost forgot to post again ๐Ÿ˜ฅ An update on Java learning I learnt about -> Strings : They are not the regular data types we know, in Java they are called objects and it is immutable I.e it cannot be changed but we have two different classes which are - StringBuffer - StringBuilder These two works on threads, one is used when you have multiple threads and the other a single thread, also one is used one multiple thread -> The static keywords which we covered static variables, method and static blocks -> Encapsulation using the private access modifier -> Getters and Setters in Java
1
2
19
581
Compare StringBuilder vs StringBuffer in Java. Learn key differences, performance, thread safety, and best use cases with examples. nkamphoa.com/stringbuilder-vโ€ฆ
4