Tagged articles
Object Creation
41 articles · Page 1 of 1
This article walks through the evolution from direct object instantiation to Simple Factory and finally to the Factory Method pattern, explaining why scattering new statements is problematic, how Simple Factory centralizes creation but still violates the Open/Closed principle, and how the Factory Method delegates the decision to specialized factories, complete with code examples, role definitions, and guidance on when to apply each approach.
Design PatternJavaObject Creation
0 likes · 16 min read


liandkJun 14, 2026 · Fundamentals
This article explains the Factory Method design pattern, illustrates its core principle of separating object creation from business logic, presents everyday analogies, and provides a complete Java implementation with abstract product, concrete products, abstract factory, concrete factories, and a test driver.
DecouplingDesign PatternJava
0 likes · 4 min read

This article explains why the interview question "String str = new String(\"abc\")" can create either one or two objects depending on JVM string pool state, detailing the JVM memory model, string pool mechanics, code examples, best practices, and common misconceptions.
InterviewJVMObject Creation
0 likes · 9 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 breaks down the exact number of objects created when using a string literal versus the new String constructor in Java, detailing interactions with the constant pool, stack, and heap, and demonstrates the resulting reference comparisons with concrete code examples.
JVMJavaObject Creation
0 likes · 5 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 compares the performance of creating objects with the new operator versus Java reflection, explains why reflection incurs a large overhead, and outlines scenarios where each approach is appropriate, helping developers choose the right technique for their code.
Object CreationReflectionnew operator
0 likes · 5 min read

This article explains the fundamental differences between using the new operator and Java reflection to instantiate objects, presents a performance benchmark showing reflection’s significant overhead, analyzes the underlying reasons, and outlines practical scenarios where each approach is appropriate.
Object CreationReflectionbenchmark
0 likes · 5 min read

This article explains why using the plain new operator is far faster than reflection, shows how an object pool can dramatically reduce memory usage and allocation time, and demonstrates a factory‑plus‑cache pattern that eliminates most repetitive new calls, delivering up to three‑fold performance gains.
BackendFactory PatternJava
0 likes · 6 min read

The article compares Java object creation using the 'new' operator versus reflection, showing through timed code examples that reflection incurs a substantial overhead—approximately thirty times slower for 100 million instances—due to dynamic type resolution and limited JIT optimization, while also outlining typical reflection use cases such as Spring IoC and JDBC driver loading.
JavaObject CreationReflection
0 likes · 4 min read

This article explains how Java handles string literals and the new String() constructor, detailing when objects are created in the string constant pool versus the heap, and demonstrates the resulting reference comparisons with code examples.
JavaObject CreationString
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 compares creating Java objects with the new operator and with reflection, presents benchmark code showing a huge performance gap, explains the underlying reasons such as JIT optimization limits and Method#invoke overhead, and outlines practical scenarios for using each approach.
JavaObject CreationReflection
0 likes · 5 min read

This article explains how Java objects are created using the new operator, details the JVM memory model (stack and heap), describes the generation and loading of .class files by the ClassLoader, compares Class.newInstance() with new, and outlines the initialization steps and key concepts developers must master.
Class LoadingJVMJava
0 likes · 11 min read

The article explains Java's basic concepts of object creation, compares the execution speed of using the new operator versus reflection, analyzes why reflection is slower, and outlines typical scenarios where each method is appropriate, supported by benchmark code and results.
JavaObject CreationReflection
0 likes · 5 min read

The Builder pattern separates object construction from its representation, enabling the same construction process to produce varied complex objects, and is illustrated through a Java house-building example that defines abstract and concrete builders, a product class, a director, and client code.
Builder PatternObject Creation
0 likes · 6 min read

This article explains the JVM's object creation process—including stack allocation, TLAB checks, Eden and Survivor spaces, and GC handling—and details the memory layout of Java objects, covering object headers, class pointers, array lengths, padding, and the effect of compressed oops on 32‑bit versus 64‑bit systems.
JVMJavaMemory Layout
0 likes · 9 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

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 demonstrates how to replace verbose Java object instantiation and setter calls with a reusable generic Builder that supports chained property setting via functional interfaces, showing both a simple example and a full implementation supporting up to three parameters per setter.
Builder PatternFunctional InterfacesGeneric Builder
0 likes · 8 min read

This article explains how Java creates objects with the new operator, details the JVM's stack and heap memory model, describes class loading and the role of Class objects, and compares newInstance with new, providing code examples and visual diagrams for deeper comprehension.
Class LoadingJVMObject Creation
0 likes · 14 min read

This article explains Python’s special __new__ constructor, shows how to override it to create singleton and multiton patterns with caching, and demonstrates the impact on object creation, memory usage, and performance through clear code examples.
CachingDesign PatternObject Creation
0 likes · 16 min read

Static factory methods in Java offer several benefits over constructors—named creation, instance reuse, flexible return types, and the ability to vary returned subclasses based on parameters—while also presenting drawbacks such as reduced subclassability and discoverability, making them a selective alternative for object creation.
Code ExampleJavaObject Creation
0 likes · 6 min read

This article presents six Java object‑creation techniques—including direct instantiation, cloning, reflection‑based allocation, dynamic class loading, constructor invocation via reflection, and deserialization—explaining each method with code examples and practical notes for developers.
JavaLombokObject Creation
0 likes · 7 min read

This article explains how Spring Framework resolves circular dependencies during object creation using a three-level caching mechanism, detailing the process through code examples and architectural diagrams.
Caching MechanismsCircular DependencyJava development
0 likes · 6 min read

This article introduces the Builder design pattern, explains its role in separating object construction from representation, provides UML class diagrams and Java code examples, outlines typical application scenarios, and discusses its advantages and disadvantages.
Builder PatternJavaObject Creation
0 likes · 5 min read

This article explains the Singleton design pattern, its core concept of ensuring a single instance, presents nine Java implementations with code examples, compares their advantages and disadvantages, discusses real‑world usage in Android and general development, and offers guidelines for when to apply the pattern.
AndroidJavaObject Creation
0 likes · 15 min read

This article explains the multiple techniques for creating objects in Java—including the new operator, Class.newInstance, reflection with Constructor, cloning via Cloneable, and deserialization—while illustrating the underlying bytecode instructions and providing concrete code examples for each method.
JavaObject CreationReflection
0 likes · 8 min read

This article explains five core techniques for instantiating Java objects—including the new keyword, Class.newInstance(), Constructor.newInstance(), clone(), and deserialization—provides code examples for each method, and demonstrates their usage in a complete program with sample output.
CloneJavaObject Creation
0 likes · 8 min read

This article explains how Objective‑C creates objects by detailing the two creation methods, the internal alloc and init implementations, the callAlloc workflow, memory allocation, and the final binding of the isa pointer, with full source code excerpts for each step.
Object CreationObjective-C++Runtime
0 likes · 11 min read

This article dissects the Java String creation process, explaining how the constant pool and heap interact, why new String("abc") can generate one or two objects, and how string concatenation and StringBuilder affect the total number of objects created during runtime.
JVMJavaObject Creation
0 likes · 8 min read

This article explains the JVM's process for creating a Java object, covering class loading checks, memory allocation strategies such as bump-pointer and free list, thread-safe allocation mechanisms, object header composition, instance data layout, padding, and the ways references locate objects via handles or direct pointers.
JVMObject CreationObject Layout
0 likes · 7 min read

This article explains the JVM's process for creating Java objects, covering class loading checks, memory allocation strategies such as bump‑the‑pointer and free‑list, object header composition, instance data layout, alignment padding, and the ways references locate objects via handles or direct pointers.
JVMMemory LayoutObject Creation
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

When Java executes a new expression, the JVM first ensures the class is loaded using the parent‑delegation model, then follows a five‑step loading and linking process before allocating heap memory, initializing fields, running static and instance code, and finally returning a reference to the new object.
Class LoadingInitializationJVM
0 likes · 8 min read

This article explains the Java Virtual Machine's class loading mechanism—including loading, verification, preparation, resolution, and initialization—and details how objects are created in memory, covering heap allocation, default values, instance initialization, and reference handling.
Object Creationclass-loading
0 likes · 6 min read

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.
Interview PreparationJVMJava
0 likes · 19 min read

This article provides an in‑depth overview of how Java objects are created and initialized, covering class loading, the various ways to instantiate objects (new, reflection, clone, deserialization), the step‑by‑step memory allocation and field initialization sequence, and the order of static and instance initialization across inheritance hierarchies.
Class LoadingInitializationJVM
0 likes · 16 min read

This article explains five Java object‑creation techniques—using the new keyword, Class.newInstance, Constructor.newInstance, clone, and deserialization—shows their bytecode differences, provides a complete Employee example, and demonstrates each method with runnable code and output.
Object CreationReflectiondeserialization
0 likes · 8 min read


Aotu LabApr 15, 2016 · Frontend Development
This article provides a comprehensive guide to writing maintainable JavaScript, covering coding conventions, variable best practices, error handling techniques, object creation methods, prototype and module patterns, and practical examples to help developers build clean, modular, and loosely‑coupled code.
JavaScriptObject Creationcoding style
0 likes · 16 min read


21CTOJan 29, 2016 · Backend Development
This tutorial walks through creating a PHP extension object by defining a zend_class_entry, naming the class, registering it, declaring properties, and implementing methods, complete with full example code and a PHP usage snippet.
ExtensionObject CreationPHP
0 likes · 4 min read
