What is the purpose of garbage collection in Java?

The purpose of garbage collection in Java is to identify and discard objects that are no longer needed by a program so that their resources can be reclaimed and reused later.

Local Class in Java

Local class or classes in Java are defined in a block, which is a group of zero or more statements between balanced braces. We typically find local classes defined in the body of a method. We can define a local class in Java inside any block. In this example we will create a local class to validate email address using…

Find Start And End Index Of A Given Element In A Sorted Array

Introduction Here I will find start and end index of a given element in a sorted array using Java programming language. So it means in the sorted array I have to find the start and end indices of a particular element. The array may also contain duplicate elements. Let’s say a sorted array is given with the elements in it…

What is static import in Java?

We will discuss about static import in Java. The static import construct allows unqualified access to static members without inheriting from the type containing the static members. Instead, the program imports the members, either individually: or all at once from a particular package.

Wrapper Class in Java

I will tell you here what is wrapper class in Java. The primitive data types are not objects; so they do not belong to any class; they are defined in the language itself. Sometimes, it is required to convert data type into an object in Java language. For example, up to JDK 1.4, the data structure accepts only objects to…

Improvements To HashMap In Java 8

Improvements To Java HashMap In this post I will tell you the number of improvements made to HashMap in Java 8 or later version. In other words I am going to discuss what are the improvements made to HashMap in Java 8 version.

What is strictfp keyword in Java?

We will discuss about strictfp keyword in Java. strictfp is a keyword in the Java programming language that restricts floating-point calculations to ensure portability. The strictfp was introduced into Java with the Java virtual machine (JVM) version 1.2 and is available for use on all currently updated Java VMs.

Why PermGen Space was removed from Java 8

Introduction We will discuss here why PermGen space was removed from Java 8. If you specify the JVM arguments PermSize and MaxPermSize then these arguments are ignored by Java HotSpot and JVM issues warnings. The warning may look like “Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512m; support was removed in 8.0”. PermGen Space and Metaspace The PermGen or…

What is Optional.get() in Java?

Introduction I will discuss here what is Optional.get() in Java. Optional is a class and get() is a method in this class. Java 8 was a huge improvement to the platform and one of the new features was added Optional.get(). So using this feature you are telling that a value may or may not be available or present in the…

String vs StringBuffer vs StringBuilder

Introduction We will discuss on String vs StringBuffer vs StringBuilder here. Basically we will find the differences between String, StringBuffer and StringBuilder.