Tagged articles
Constant Pool
28 articles · Page 1 of 1
This article explains Java String immutability, the hidden object creation behind '+' concatenation across JDK versions, StringBuilder and StringBuffer internals, constant pool behavior, and the invokedynamic optimization in JDK 9+, with bytecode examples and performance best practices.
Constant PoolJVMJava
0 likes · 16 min read

This article explains the three Java constant pools—class file, runtime, and string—detailing their evolution from compilation to execution, their memory locations across JDK versions, how string literals are interned, code examples illustrating their behavior, common misconceptions, and typical interview follow‑up questions.
Constant PoolInterviewJVM
0 likes · 15 min read

Creating a String with new String("abc") can generate either one or two objects depending on whether the literal "abc" already exists in the JVM’s string constant pool, affecting object placement in the pool versus the heap and influencing reference equality comparisons.
Constant PoolJavaObject Creation
0 likes · 4 min read

This article explains how Java handles string literals and `new String()` expressions, detailing when objects are created in the string constant pool versus the heap, and demonstrates the resulting reference comparisons with example code.
Constant PoolJavaObject Creation
0 likes · 3 min read

This article explains the structure, contents, and characteristics of Java's Class constant pool and runtime constant pool, detailing how literals and symbolic references are stored, how the runtime pool can be dynamically modified, and the impact on memory and JVM linking.
Constant PoolJVMJava
0 likes · 6 min read

This article explains Java’s constant pools, detailing the class constant pool stored in .class files, its transformation into the runtime constant pool during JVM loading, and the specialized string constant pool that optimizes memory usage, including recent changes moving it to heap memory.
Constant PoolJVMJava
0 likes · 3 min read

This article explains how Java creates objects for various String assignments—using new String("long"), a literal "long", or concatenated literals "lo" + "ng"—detailing when one or two objects are allocated based on the presence of the literal in the string constant pool.
Constant PoolJavaObject Creation
0 likes · 3 min read

This article explains how the Java Virtual Machine achieves platform and language independence, details the compilation process from source code to class files, and provides an in‑depth analysis of the class file format, constant pool, bytecode instructions, access flags, and related metadata.
Constant PoolJVMJava
0 likes · 14 min read

This article explains the evolution of the Java method area, analyzes bytecode generated by `String s = new String("xyz")` and `String s = "xyz"`, and clarifies why the expression creates one or two objects depending on whether the literal already exists in the constant pool.
BackendConstant PoolObject Creation
0 likes · 7 min read


政采云技术Dec 13, 2022 · Frontend Development
This article explains how JavaScript code is represented in V8's memory, covering primitive types, the roles of the stack, heap, and constant pool, as well as function prototypes, variable hoisting, and garbage collection, with clear examples and diagrams.
Constant PoolHeapV8
0 likes · 12 min read

This article explains how Java handles string literals and new String objects, detailing the creation of objects in the constant pool and heap, the resulting memory layout, and the outcomes of reference comparisons, while also providing code examples and additional resources.
Constant PoolJavaObject Creation
0 likes · 5 min read

This article explains the Java constant pool concept, details how the String constant pool works in different JDK versions, demonstrates the effects of String.intern() with code examples, and discusses practical applications and pitfalls of using intern for memory optimization and synchronization.
Constant PoolJVMString.intern
0 likes · 16 min read

This article explains Java's String length limits, detailing how the underlying char[] array, int return type, and JVM constant‑pool specifications together define both the theoretical 2^31‑1 character maximum and the compile‑time literal limit of 65,534 characters.
Constant PoolJVMJava
0 likes · 8 min read

This article explains the theoretical and practical limits of Java String length, detailing how strings are stored as char arrays, the impact of the JVM constant‑pool specification (u2 index limit of 65534), and how runtime concatenation can exceed compile‑time restrictions.
Constant PoolJVMJava
0 likes · 8 min read

This article explains Java’s constant pool architecture, the role of the String pool across JDK versions, demonstrates how String.intern() works with code examples, and shows how interning can dramatically reduce memory usage while also highlighting potential pitfalls.
Constant PoolJVMJava
0 likes · 15 min read

Java’s String length is constrained by both the int‑based array storage allowing up to 2^31‑1 characters and the JVM class‑file constant‑pool limit of 65,534 bytes for literal strings, a nuance explained through source code, JVM specifications, and practical experiments.
Constant PoolJVMJava
0 likes · 8 min read

This article explains why Java strings have a theoretical maximum size of about 2^31‑1 characters at runtime, but literal strings defined in source code are limited to 65 534 characters due to JVM constant‑pool specifications, and demonstrates the limits with practical experiments.
BackendConstant PoolJVM
0 likes · 8 min read

Java's String type has both theoretical and practical length limits: while the underlying char[] array can hold up to 2^31‑1 characters (~4 GB) due to int indexing, the JVM constant‑pool restricts literal strings to a maximum of 65 534 characters, as explained with code examples and spec excerpts.
Constant PoolJVMJava
0 likes · 8 min read

This article explains why identical integers and short strings may reference the same object in Python, how the small‑integer cache and string interning work, and how compilation units and constant pools affect object identity across interactive sessions and script files.
Compilation UnitConstant PoolInteger caching
0 likes · 8 min read


ITPUBDec 8, 2020 · Fundamentals
Java’s String length is bounded by both the int‑based array limit (≈2 billion characters) and a JVM compile‑time restriction of 65,534 characters due to the constant‑pool’s u2 index, a nuance explained through source code examples, JVM spec excerpts, and a practical experiment.
Constant PoolJVMJava
0 likes · 8 min read

This article explains how Java stores strings using a char array, the theoretical maximum length of 2^31‑1 characters, and why the JVM limits string literals to 65,534 characters due to constant‑pool u2 indexing, illustrated with code examples and a practical experiment.
Constant PoolJVMJava
0 likes · 9 min read

This article explains why Java strings have length limits, detailing the char[] storage, the int‑based array size ceiling, the JVM constant‑pool u2 restriction of 65535 bytes, and demonstrates a compile‑time experiment building a 65,534‑character literal to illustrate the practical impact.
Constant PoolJVMJava
0 likes · 8 min read

This article explains how Java strings are stored, the theoretical 2^31‑1 character limit imposed by the underlying char[] array, and the practical 65534‑character limit enforced by the JVM constant‑pool specification, illustrated with code examples and a small experiment.
Constant PoolJVMJava
0 likes · 8 min read

This article investigates whether Java int primitives are cached during execution, detailing JVM stack allocation, the specific bytecode instructions (iconst, bipush, sipush, ldc) used for different int ranges, and how local variable tables and operand stacks interact, illustrated with code and bytecode examples.
Constant PoolJVMJava
0 likes · 7 min read

This article explains why the new String("xxx") expression may create one or two objects depending on the presence of the literal in the JVM's string constant pool, demonstrates the behavior with compiled bytecode and runtime examples, and clarifies common interview misconceptions about Java string object creation.
Constant PoolJVMJava
0 likes · 12 min read

This article explains how Java handles String literals and concatenation, detailing the roles of the String constant pool, the effects of the '+' operator invoking StringBuilder.append, the placement of resulting strings in the heap versus the pool, and demonstrates these concepts through bytecode analysis and code examples.
Constant PoolJavaString
0 likes · 12 min read

This article explains the Java constant pool, distinguishing static and runtime pools, demonstrates string interning behavior with code examples, and shows how to inspect class files and memory settings to observe constant pool effects in the JVM.
Constant PoolJVMmemory management
0 likes · 9 min read

This article explains why the same integer values can produce different results with the ‘is’ operator in Python, covering small‑integer caching, the general integer object pool, constant pools, and the distinction between whole‑module and line‑by‑line execution modes.
Constant PoolInteger cachinginterpreter
0 likes · 9 min read
