convert stringbuffer to string

Convert StringBuffer to String

After knowing the differences between String, StringBuffer and StringBuilder, let us Convert StringBuffer to String and vice versa. It is very much required in coding. Convert StringBuffer to String A StringBuffer object can be converted to String using toString() method of Object class.

In the above code, equals() method…