Tag

StringBuffer

0 views collected around this technical thread.

Selected Java Interview Questions
Selected Java Interview Questions
Apr 5, 2021 · Backend Development

Understanding Thread Safety in Java: StringBuilder, StringBuffer, and Servlets

This article explains the thread‑safety differences between StringBuilder and StringBuffer, demonstrates the problems of using mutable shared objects in multithreaded Java code, presents three solutions, and discusses why Servlets are not thread‑safe by default, highlighting visibility and ordering concepts.

Backend DevelopmentConcurrencyJava
0 likes · 10 min read
Understanding Thread Safety in Java: StringBuilder, StringBuffer, and Servlets
Selected Java Interview Questions
Selected Java Interview Questions
Jun 13, 2020 · Fundamentals

Why StringBuilder Is Not Thread‑Safe and How It Differs from StringBuffer

This article explains the internal implementation of Java's StringBuilder and StringBuffer, demonstrates how concurrent appends cause incorrect lengths and occasional ArrayIndexOutOfBoundsException, and shows why StringBuffer remains thread‑safe by using synchronized methods.

ConcurrencyJavaStringBuffer
0 likes · 7 min read
Why StringBuilder Is Not Thread‑Safe and How It Differs from StringBuffer
Full-Stack Internet Architecture
Full-Stack Internet Architecture
Jun 13, 2020 · Fundamentals

Understanding Java String, StringBuilder, and StringBuffer

This article explains the immutable nature of Java's String class, compares it with mutable StringBuilder and thread‑safe StringBuffer, shows how the JVM handles string literals, constant pool, intern(), and provides performance guidelines and code examples for efficient string manipulation.

JavaPerformanceStringBuffer
0 likes · 16 min read
Understanding Java String, StringBuilder, and StringBuffer
Architect's Tech Stack
Architect's Tech Stack
Oct 21, 2019 · Backend Development

Why StringBuilder Is Not Thread‑Safe and How It Differs from StringBuffer

The article explains why StringBuilder is not thread‑safe, analyzes its internal implementation and the non‑atomic count update that leads to incorrect lengths and occasional ArrayIndexOutOfBoundsException, and shows that using synchronized StringBuffer avoids these issues.

Backend DevelopmentJava ConcurrencyStringBuffer
0 likes · 7 min read
Why StringBuilder Is Not Thread‑Safe and How It Differs from StringBuffer
Java Captain
Java Captain
Mar 2, 2018 · Fundamentals

Understanding Java String, StringBuilder, and StringBuffer: Differences, Performance, and Interview Questions

This article explains the internal implementation of Java's String class, compares it with StringBuilder and StringBuffer, demonstrates performance differences through benchmark code, and provides common interview questions with detailed answers, helping developers choose the appropriate class for various scenarios.

InterviewJavaPerformance
0 likes · 16 min read
Understanding Java String, StringBuilder, and StringBuffer: Differences, Performance, and Interview Questions