Usage & benefits of “super” keyword in Java

super keyword

super keyword is used to call parent class methods, variables in child class for ease of use, also can be used to invoke parent class constructor.

Only public and protected methods / variables can be accessed by using super keyword, can’t access private methods/variables of parent class.

NOTE : Using super keyword should be the first line in a method of child class, else will get compile error.


Watch here for more details

Usage of this keyword in java


Code sample

Parent class –


Child class –

Hope that helps!

Content posted is based on learning or working experience,
Share the post with others if find useful,
Any queries?, leave comments or discuss on our, Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *