Java ClassesLesson 36Free preview
Java super Keyword
This lesson is part of Java · All levels
Summary
The keyword super refers to the parent class (superclass) of the class where the code is written. Its functions include calling the parent constructor with super() and accessing the parent method that has already been overridden with super.method(). The super use clarifies the relationship between the derived class and its parent.
Key points
- Super() calls the constructor superclass and must be at the beginning of the constructor child
- Super.method() calls for a version of the method belonging to the superclass
- Java adds super() automatically when not written by the programmer
- Super differs from this: super refers to the parent, this refers to the object at present
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.