Category Java
How to Create Immutable Class in Java
An immutable class in Java is a class whose state of an object cannot be changed or modified after it is created. In other simple words, a class whose objects are immutable (i.e., unmodifiable) is called immutable class in Java.…
Difference Between String, StringBuffer, and StringBuilder

In this tutorial, we will discuss the fundamental difference between String, StringBuffer, and StringBuilder in Java with the help of examples. Java language provides three classes: String, StringBuffer, and StringBuilder to work with string that represents a sequence of characters.…
StringBuilder Class in Java | Methods, Example
StringBuilder class in Java represents a mutable sequence of characters (string). That is, we can change (or modify) the content of StringBuilder, without creating a new StringBuilder object. In other simple words, we can add or delete a new content…
StringBuffer Methods in Java
In addition to be inherited from the Object class methods, StringBuffer class also provides some useful methods in Java. They are as follows: append() capacity() charAt() delete() ensureCapacity() getChars() indexOf() insert() length() reverse() and many more. So, let’s understand each…
String Class in Java | Methods, Examples
In an application or a program, it is common to work with the sequence of text character (e.g., for user interactions or data processing). To support character strings, Java programming language provides a string class. This string class helps to…