Java Immutable Objects

An object is considered immutable if its state cannot change after it is constructed. Since they cannot change state, they cannot be corrupted by thread interference or observed in an inconsistent state, making them useful in concurrent applications.

For example, String objects in Java are immutables.

Java Switch Statement

Switch statement in Java is for decision making. Unlike if-then and if-then-else statements, the switch statement can have a number of possible execution paths.

Syntax

The general form of a switch statement is:

Java Garbage Collection Basics

Objects dynamically created using a new operator are deallocated automatically. The technique that accomplishes this is called garbage collection. It works like this: When no references to an object exist, that object is assumed to be no longer needed, and the memory occupied by the object can be reclaimed.

How Does Automatic Garbage Collection Work?

Automatic garbage collection works by looking at heap memory, identifying which objects are being referenced and which are not, and deleting the unused objects. This is widely known as the "Mark and Sweep Algorithm."

Spring Security 5 Form Login With Database Provider

Spring Security is a framework that focuses on providing both authentication and authorization to Java applications. It is one of the most powerful and highly customizable authentication and access control frameworks in the Java ecosystem.

This article is going to focus on Spring Security Form Login which is one of the most necessary parts of web applications. The example I am presenting here is a part of pdf (Programming Discussion Forum), a web application built with Spring 5, Hibernate 5, Tiles, and i18n.