Grokking Java Intermediate
0% completed
Super Keyword
The super keyword in Java is a reference variable used to refer to the immediate parent class object. It serves multiple purposes in inheritance, allowing subclasses to access superclass members (variables and methods) and constructors. Understanding how to effectively use super is essential for leveraging the full power of inheritance in Java.
Uses of the super Keyword
- Calling the Superclass Constructor:
- Used to invoke the constructor of the parent class.
- Before Java 25, it must be the first statement in the subclass constructor
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%