Object Cloning in Java: Shallow, Deep, and Serialization Strategies

Primitive assignments in Java duplicate the actual value: int count = 10; int tally = count; This behavior applies to all eight primitive types. Object variables, however, store memory addresses rather than the objects themselves. Direct assignment therefore creates an alias, not an independent entity: class Employee { private int badgeId; ...

Posted on Fri, 05 Jun 2026 18:12:29 +0000 by hand

Understanding Shallow and Deep Copying of Objects in JavaScript

// Assigning a value from a to b let a = 12; let b = a; This method works for primitive types. What happens if a is an object? Let's examine what occurs in memory: Declaring a = 12 allocates a space in the stack. When a is assigned to b, another space is created in the stack, and b holds the same value as a. If a is an object, what happens in ...

Posted on Sat, 30 May 2026 21:40:20 +0000 by RootKit

Building a Custom String Class in C++

A custom string class typically wraps a dynamically alocated character array along with size and capacity tracking. The following implementation lives inside a dedicated namespace to avoid collisions with the standard library. namespace custom { class string { private: char* _data; size_t _len; size_t _cap; ...

Posted on Fri, 08 May 2026 01:30:05 +0000 by BRUUUCE