Immutable Nature of Java Strings

The "Immutable Nature of Java Strings" refers to the fact that once a String object is created in Java, its value cannot be changed or modified. This means that any operation that seems to modify the string actually results in the creation of a new String object rather than altering the original one. How String […]

person shubham sharmaaccess_time November 17, 2024launch Read More

immutable class in java

In Java, an immutable class is a class whose instances (objects) cannot be modified once created. Any modification to an instance of an immutable class results in the creation of a new instance, leaving the original instance unchanged. String is the most common example of an immutable class in Java, but you can create your […]

person shubham sharmaaccess_time November 17, 2024launch Read More

What is hash map?

A HashMap is a data structure in Java that implements the Map interface. It stores key-value pairs, where each key is associated with exactly one value. It is widely used when you need to efficiently retrieve, update, or delete elements based on a key. HashMap is part of the Java Collections Framework and provides constant-time […]

person shubham sharmaaccess_time November 17, 2024launch Read More

heap vs stack memory in java

In Java, heap memory and stack memory are two primary areas of memory management, each serving different purposes. Understanding the differences between them is key to efficient memory usage, performance optimization, and preventing memory-related issues. 1. Stack Memory The stack memory in Java is used for: Storing primitive data types (like int, double, boolean, etc.). […]

person shubham sharmaaccess_time November 17, 2024launch Read More

Garbage Collector

Java provides several types of garbage collectors, each designed for different kinds of applications with varying performance requirements. These garbage collectors manage memory by reclaiming unused objects and free heap space, but they differ in how they prioritize factors such as throughput, pause times, and heap size. Below are the main types of garbage collectors […]

person shubham sharmaaccess_time November 17, 2024launch Read More

G1 Garbage Collector

G1 Garbage Collector (Garbage First Collector) The G1 (Garbage-First) Garbage Collector is a server-style, low-pause, concurrent, and parallel garbage collector introduced in Java 7 and became the default garbage collector in Java 9. G1 is designed to replace other collectors, such as the CMS (Concurrent Mark-Sweep) and the Parallel GC, by providing a balance between […]

person shubham sharmaaccess_time November 17, 2024launch Read More

SOLID principles

The SOLID principles are five design principles in object-oriented programming that help create more maintainable, flexible, and scalable software. They were introduced by Robert C. Martin (also known as “Uncle Bob”) and are widely used as guidelines to achieve clean, high-quality code. Here’s an overview of each of the SOLID principles: 1. Single Responsibility Principle […]

person shubham sharmaaccess_time November 17, 2024launch Read More

Fail safe and fail fast in java

Fail-Safe and Fail-Fast are two concepts in Java that describe how an iteration over a collection behaves when the collection is modified during the iteration. They are primarily related to how collections handle concurrent modifications during iteration, which can either fail immediately or continue working safely. 1. Fail-Fast Iterators: Fail-Fast iterators immediately throw a ConcurrentModificationException […]

person shubham sharmaaccess_time November 17, 2024launch Read More

4. Application System ClassLoader

The Application ClassLoader (also known as the System ClassLoader) is a class loader in Java responsible for loading classes defined by the application, such as those from the application’s classpath. It sits at the top of the Java ClassLoader hierarchy, above the Bootstrap and Extension ClassLoaders, and is the default class loader for classes in […]

person shubham sharmaaccess_time November 17, 2024launch Read More

3. Extension ClassLoader in Java

The Extension ClassLoader in Java is a class loader responsible for loading additional classes and libraries that extend the core Java runtime. It sits between the Bootstrap ClassLoader and the Application (System) ClassLoader in the class-loading hierarchy, and it specifically loads classes from Java’s extension libraries. Key Characteristics of the Extension ClassLoader Location of Extension […]

person shubham sharmaaccess_time November 17, 2024launch Read More