Super keyword in java
Hello friends, Hitesh is here; Today we will learn some basic point related to Super keyword in java.
Definition:
Super keyword in java is a reference variable that is used to refer immediate parent class object.Note: One point always remember about super keyword is; super() is added in each class constructor automatically by compiler and it is must be first statement.
Uses of Super Keyword
- super.<variable_name> refers to the variable of variable of parent class.
- super() invokes the constructor of immediate parent class.
- super.<method_name> refers to the method of parent class.
Difference between Super and This keyword
this keyword used to store current object reference and super keyword used to store super class reference in subclass object.For complete tutorial you can visit our own website. Thanks
No comments:
Post a Comment