Hello guys, in this blog we are going to talk about the different areas of memory that JVM creates and handles throughout the lifecycle of a program. In this blog, I have tried my best to explain in detail with examples and diagrams.

Before diving deep, let us see how JVM resides on the memory (RAM).

Image for post
Image for post

Like other applications, the JVM also occupies some part of the RAM. The occupied RAM is divided into the following categories


Image for post
Image for post

Hello guys, in this blog, we are going to talk about the new methods which were introduced in Java 8. Following are the ones which we will look into in detail.

  • computeIfAbsent
  • computeIfPresent
  • compute
  • merge

Initially, we will look into the basic examples of each one of them, and later on, we will see how it works in the case of a multi-threaded environment.

Let us start with computeIfAbsent method.

The computeIfAbsent method takes a key and mapping function as an input. If the specified key is not present in the map or it is mapped to a null…


Image for post
Image for post

Hello guys, I am back with a new blog and in this blog, we are going to talk about some important aspects of Java such as

  • Difference between JDK, JRE, and JVM
  • The Java Compiler
  • Internals of JVM

Let us first start with the differences between JDK, JRE, and JVM.

  • JDK — JDK stands for Java Development Kit. It provides a software development environment for developing Java applications. It includes the Java Runtime Environment (JRE), an interpreter (java), a compiler (javac), an archiver (jar), a documentation generator (Javadoc), and other tools required for the development of applications.
  • JRE — JRE…


Image for post
Image for post

Hello guys, in this blog we are going to talk about the CompletableFuture which was introduced in Java 8. But before looking into it, let me give you some background of the Future.

Futures were introduced in Java 5. They are basically placeholders for a result of an operation that hasn’t finished yet. Once the operation finishes, the Future will contain the result. For example, an operation can be a Runnable or Callable instance that is submitted to an ExecutorService. The submitter of the operation can use the Future object to check whether the operation isDone(), or wait for it…


Image for post
Image for post

Hello guys, after looking into some intense topics, it is time to pick some simple ones. So, in this blog, we are going to talk about String class and String Pool. Let us begin…

String class is one of the widely used classes all around the globe. It is used right from storing a simple string such as name to the encrypted passwords.

If you see the String class definition, it has been declared as final. So once the String object is created, it cannot be modified. Have you ever thought about why it is immutable?. …


Image for post
Image for post

Welcome back guys, this blog is a continuation of the previous blog where we talked about Threads and Executor Framework. If you haven’t visited, here is the link.

Hi In the previous blog, I mentioned about a new thread pool in the Executor Framework named newWorkStealingPool, which was introduced in Java 8. If you see its internal implementation, it uses ForkJoinPool. So in this blog, we are going to talk about the Fork Join Framework and of course, the ForkJoinPool. Let us get started…

Basically, the Fork Join Framework uses a recursive divide and conquer strategy where a big problem…


Image for post
Image for post

Hello guys, in this blog we are going to talk about a very important topic, that is threads. We will first start with what is thread and how it is different from a process, how we can create a thread in different ways, and later on, we will deep dive into Executor Framework. So, are you guys excited?

Let us begin…

A process is a program that is in execution. For example, a java program is executed inside a JVM process. Each process is allocated a part of a RAM which is not shared with any other process. …


Image for post
Image for post

Hello guys, I am back with the new blog and in this blog, we will discuss best practices to handle exceptions. Let us get started…

  1. Cleaning Up Resources in the Finally Block

If you use any resource for example InputStream, it is very important to release the resource or close the resource. If you don’t, you might end up utilizing the resource indefinitely (Memory leak). The best way to handle this situation is to release the resource in the finally block. As you all know, finally block is executed no matter what exception occurs or not.

In the above…


Hello guys, I am back with a new blog. This blog is an extension of two previous blogs listed below. I would recommend you to go through these blogs before starting with this one.

In this blog, we will look into some simple but important points with respect to Type Inferences, Lambda Expressions, and Method References. Lets us start with type inferences.

Type inference was introduced in Java 5 in the form of Generics. Type inference is the Java compiler’s ability to look at each method invocation and corresponding declaration to determine the type argument

Let us understand with the…


Image for post
Image for post

Hello guys, this blog is from Java 8 as well as Java 9 and we are going to talk about the interface and its members. Later on, we will see the difference between an interface and an abstract class.

I have already posted a few topics from Java 8. Here are the links

Prior to Java 8, an interface can have constant variables and abstract methods. Any class wants to implement an interface, has to implement all its methods. See the example below.

In the above example, I have declared an interface Message in which, there is an abstract…

Aman Agrawal

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store