Computer Science, asked by arohi4, 1 year ago

what is super class in Java program?

Answers

Answered by Venkysharma27
2
Java Programming/Keywords/super. It is used inside a sub-class method definition to call a method defined in the super class. Private methods of the super-class cannot be called. Only public and protected methods can be called by the super keyword.
Please mark my answer as brainleast
Answered by usp488
3
Hiii Arohi....

Subclasses and Superclasses
To recap what you've seen before, classes can be derived from other classes. The derived class (the class that is derived from another class) is called a subclass. The class from which it's derived is called the superclass. The following figure illustrates these two types of classes:

In fact, in Java, all classes must be derived from some class. Which leads to the question "Where does it all begin?" The top-most class, the class from which all other classes are derived, is the Object class defined in java.lang. Object is the root of a hierarchy of classes, as illustrated in the following figure.

The subclass inherits state and behavior in the form of variables and methods from its superclass. The subclass can use just the items inherited from its superclass as is, or the subclass can modify or override it. So, as you drop down in the hierarchy, the classes become more and more specialized:
Definition: A subclass is a class that derives from another class. A subclass inherits state and behavior from all of its ancestors. The term superclass refers to a class's direct ancestor as well as all of its ascendant classes.

Thankyou.

HOPE IT HELPS. :-)
Attachments:
Similar questions