What is the Superclass of StringBuilder and StringBuffer

Their javadoc page shows they both extend from Object:

public final class StringBuilder
extends Object
implements Serializable, CharSequence

public final class StringBuffer
extends Object
implements Serializable, CharSequence
Is Object really the direct superclass of StringBuilder and StringBuffer? Since the two string-related classes are so similar (see my previous post for a short comparison), doesn't it make sense for them to have a common superclass?

Yes, they do share a common abstract superclass, java.lang.AbstractStringBuilder, as revealed in their source code:
public final class StringBuilder
extends AbstractStringBuilder
implements java.io.Serializable, CharSequence {
/** use serialVersionUID for interoperability */
static final long serialVersionUID = 4383685877147921099L;
AbstractStringBuilder is an abstract class with package access type:
abstract class AbstractStringBuilder
implements Appendable, CharSequence {


Anna said...

Great and Useful Article.

Online Java Training

Java Online Training India

Java Online Course

Java EE course

Java EE training

Best Recommended books for Spring framework

Java Interview Questions

Java Course in Chennai

Java Online Training India

eMexoT said...

Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.

Internet Of Things training in electronic city

Cipro said...

A website is much powerful than you could ever imagine. Strategic website design by improving user experience can improve your online friv 2020 sell & conversion. It's can make you successful in business. Thanks!

Institute in Gurgaon said...

Crafted by Python developers and coders never go unnoticed in the open source network. Open Source people group contract Python Script engineers who can work with IBM SPSS Statistics User Interface. This interface empowers clients to control Object, and run command linguistic structure for redid programs. The individuals who have a convenient encounter of working with IBM SPSS Statistics with Python, they can take on complex troubleshooting and remote scripting projects from their own work area at home.
For More Info:- Python Course in Gurgaon