Friday, 31 May 2019

How to create immutable class in Java

An immutable class is one whose state can not be changed once created. There are certain guidelines to create a class immutable in Java.

1. Rules to create immutable classes

Don’t provide “setter” methods — methods that modify fields or objects referred to by fields.

Why Strings are Immutable in Java?

An immutable object is an object which state is guaranteed to stay identical over its entire lifetime. This is really a good definition. Isn’t it? It means that the state of object once initialized, can never be changed anyhow.

Spring Boot @ConfigurationProperties and Properties File

 In this tutorial, you will learn to use @ConfigurationProperties to map properties files to POJO classes in Spring Boot application. Let’s ...