Wrapper Classes in Java

In this tutorial, I am going to explain what are wrapper classes in java. Why it is introduced and the concept of autoboxing and unboxing.

Wrapper Class

As the name suggests, a wrapper class wraps (encloses) around a primitive data type and gives it an object appearance. In simple words, we can convert primitive data types into an object using their corresponding wrapper class.

Wrapper classes are final and immutable.

How to create immutable class in java

For example:

Primitive Data Type

A primitive data type defines the size and type of variable values. In Java, we have eight primitive data types, which are as follows:

Open Closed Principle in Java | SOLID Principles

The Open Closed principle (OCP) is one of the most important object oriented design principle. In this article, I am going to cover what is open closed principle. How to implement this design principle in our code or module.

The open closed principle is one of the five design principles of object-oriented design. These set of five principles are known as SOLID principles.

In my previous post, i have already explained single responsibility principle. In subsequent tutorials, I’ll cover rest of the principles.