Java StringBuilder toString() Method

The Java StringBuilder toString() method is used to retrieve a string representing the data in a StringBuilder object. A new String object is allocated and initialized to contain the character sequence currently represented by this object.