We all know that the String class in Java is mutable i.e. once we create a String variable we cannot modify its data or do any manipulations.
But, there may be scenarios where we need to modify the data of String variables. In such cases, we could use StringBuffer class.
This class −