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.…

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…