The super keyword is another important one. This is a reference variable that is used to call the immediate parent class. This keyword is expensive when we talk about Inheritance and Polymorphism. There are three uses of the super keyword.
- super with variables
super with constructors with method overridingsuper
Super with variables
- If you use super with instance variables, it will refer to the variables of the immediate parent class.
- Look at the following example.
Super with constructors
- We can use the super keyword to invoke the constructor of the immediate parent class
- Once you instantiate a class, the compiler calls the default constructor of that class.
Super with method overriding
- If you want to call methods in the parent class, you can use super keyword.
- In overriding, it will call the child class method instead of the parent class.
- Look at the following example.
Use of super keyword in Java
Reviewed by Ravi Yasas
on
12:41 PM
Rating:

It’s amazing in support of me to truly have a web site that is valuable meant for my knowledge.
ReplyDeleteThe QSR, or quoted search result, on the keyword tool is the number of competing websites ranked in Google looking for the first page ranking for that exact keyword.keyword combination tool
ReplyDeleteI’m going to read this. I’ll be sure to come back. thanks for sharing. and also This article gives the light in which we can observe the reality. this is very nice one and gives indepth information. thanks for this nice article... https://www.seoexpertindelhi.in/
ReplyDelete