Tag

String Pool

1 views collected around this technical thread.

Java Captain
Java Captain
Mar 25, 2024 · Fundamentals

Understanding the Underlying Implementation of Java String Immutability

This article explains why Java's String class is immutable, detailing the benefits such as thread safety, cached hash codes, and string pooling, and describes the internal mechanisms—including a private final char array, creation of new objects on concatenation, and the intern method—that enforce this immutability.

ConcurrencyJavaMemory Management
0 likes · 5 min read
Understanding the Underlying Implementation of Java String Immutability
macrozheng
macrozheng
Jul 3, 2023 · Fundamentals

Why Java Creates Only One String Object: Understanding Constant Folding

This article explains how Java's compiler optimizes string concatenation through constant folding, the rules that define compile‑time constants, and why only a single String object is created in many seemingly multiple‑object scenarios.

Compile-time ConstantConstant FoldingJVM
0 likes · 11 min read
Why Java Creates Only One String Object: Understanding Constant Folding
Architect's Tech Stack
Architect's Tech Stack
May 12, 2021 · Fundamentals

Understanding Java String Immutability and the String Constant Pool

This article explains why Java strings are immutable, how the JVM uses the string constant pool and the final keyword to manage memory, and demonstrates the behavior with code examples that show reference handling, object creation, and common string operations.

JVMJavaMemory Management
0 likes · 11 min read
Understanding Java String Immutability and the String Constant Pool
Full-Stack Internet Architecture
Full-Stack Internet Architecture
Oct 16, 2019 · Fundamentals

Understanding Java String Pool, intern() Method, and Comparison Techniques

This article explains how Java's String class encapsulates character arrays, the role of the string pool, the effects of the new operator, the intern() method, and the proper use of == versus equals() for reliable string comparison and memory optimization.

JavaMemory ManagementObject Comparison
0 likes · 8 min read
Understanding Java String Pool, intern() Method, and Comparison Techniques
Java Captain
Java Captain
May 27, 2019 · Fundamentals

Java Runtime Memory Areas, Object Creation, and Common Interview Questions

This article explains Java's runtime memory regions, including the program counter, stacks, heap, method area, constant pool, and direct memory, and details the HotSpot object creation process, memory layout, access mechanisms, as well as String and wrapper class behaviors, providing essential knowledge for Java interview preparation.

JVMJavaMemory Management
0 likes · 19 min read
Java Runtime Memory Areas, Object Creation, and Common Interview Questions