1.

What Is A Superclass?

Answer»

When you derive one class from another in Java, you establish relationships between the VARIOUS classes. The parent class (or the class it is being derived from) is OFTEN called the SUPERCLASS or BASE class. The superclass is really an ordinary class which is being extended by another class. In other words, you do not need to do anything special to the class in order for it to become a superclass. Any of the classes you write may some day become a superclass if someone decides to create a new subclass derived from your class.

Of course, you can prevent a class from BECOMING a superclass (that is, do not allow it to be extended). If you use the final keyword at the start of the class declaration, the class cannot be extended.

When you derive one class from another in Java, you establish relationships between the various classes. The parent class (or the class it is being derived from) is often called the superclass or base class. The superclass is really an ordinary class which is being extended by another class. In other words, you do not need to do anything special to the class in order for it to become a superclass. Any of the classes you write may some day become a superclass if someone decides to create a new subclass derived from your class.

Of course, you can prevent a class from becoming a superclass (that is, do not allow it to be extended). If you use the final keyword at the start of the class declaration, the class cannot be extended.



Discussion

No Comment Found