Create Immutable class in java

Immutable Object: An object is known as immutable if its state can not be changed over time or we can say after object creation. Need for Immutable Classes In current days, most of the applications are running into multi-threading environments which results in concurrent modification problems. Popular Immutable classes in java All wrapper classes (java.lang.Integer, … Read more

Java Substring

A substring is a string that is part of a longer string. String class provides the following methods to get a substring from a string. 1. public String substring(int startIndex): Returns a new string that starts from a specified string and extends to the end of this string.  It will throw IndexOutOfBoundsException – if startIndex … Read more

Java String Concatenation

The general meaning of concatenation is a series of interconnected things. String concatenation refers to the combination of more than one string. Ways of String concatenation: By concatenation operator +. By concat() method. 1. By concatenation operator + String concatenation can be performed with the + operator. String concatenation is performed by the StringBuilder or … Read more

Java Static keyword

Static is a keyword in Java used to represent the class members. It can be used with variables, methods, initializer blocks, and nested classes. Types of class members: Static data members. Static initializer block. Static method. Static nested class. 1. Static data members: Data members declared with static keywords are known as static data members. … Read more