Java

What is a NullPointerException, and how to fix it?

NullPointerException (NPE) is a notorious runtime exception that plagues Java developers, often leading to unexpected crashes and errors in their applications. In this blog, we’ll explore the causes of NullPointerExceptions, examine common scenarios where they occur, and provide practical examples and best practices for preventing and handling them effectively. Causes of NullPointerException: Uninitialized Variables: In…

Leetcode

1814. Count Nice Pairs in an Array

Introduction: The problem involves identifying pairs of indices in an array that satisfy certain conditions, with a specific mathematical operation. This blog will discuss the problem, the provided solution, and break down the code for a better understanding. Problem Overview: The goal is to find the count of such nice pairs of indices. Due to…

Tech

Deprecating Elements in gRPC: A Complete Guide

gRPC is a powerful framework for defining and using services that run over HTTP/2. It’s particularly efficient for low-latency, high-throughput applications. Over time, as you develop gRPC-based systems, you might encounter the need to deprecate certain parts of your API, such as services, methods, fields, or even entire messages. Deprecation is crucial when you need…

Java

Understanding Class and Object-Level Locks in Java

In the world of multithreading, synchronization is a crucial concept to ensure that threads don’t interfere with each other while accessing shared resources. Class and object-level locks are two mechanisms used in Java to achieve this synchronization. In this blog, we’ll explore what class and object-level locks are, when to use them, and their advantages…

Tech

TIL – Native modifier in Java

While going through multithreading in java you must have came across this function “Thread.yield This function is special for me because the definition of the function is So let’s go in detail about the native modifier In Java, the native modifier is used to indicate that a method is implemented in a platform-specific manner, typically…

Tech

How to make a class Immutable in java

Making a class immutable means that its state cannot be changed once it’s created. In other words, all the fields of the class are set at the time of instantiation and cannot be modified afterward. This can be achieved by using the following techniques: Declaring all fields as final: This ensures that the fields cannot…

Tech

Why reflection in java is a problem?

Reflection in Java is a mechanism that allows a program to examine and manipulate the structure and behavior of objects at runtime. With reflection, a program can inspect and modify fields, methods, and constructors of a class, as well as access information about the class itself, such as its name, superclass, and interfaces. Reflection is…

Tech

Polymorphism in Java

Just revisiting and explaining myself Polymorphism concept here through a blog post. The words Polymorphism means multiple forms. In Java ,Polymorphism means multiple forms of an object. We shall divide this article into 3 sections. 1.Syntax 2.Calling a variable polymorphically. 3.Calling a method polymorphically. 1.Syntax Now in polymorphism in Java, the thumb key rule to…