View Full Version : What is the difference between super() and this()?
priya01
06-02-2016, 10:43 PM
What is the difference between super() and this()?
penrix
06-02-2016, 11:50 PM
super() is used to call super class constructor, whereas this() used to call constructors in the same class, means to call parameterized constructors.
pxljobs
08-25-2016, 03:20 AM
The keyword this() used to invoke a constructor of the same class super() can be used to invoke a super class constructor this is the main difference of the super and this keyword.
jeffronald19
12-27-2016, 10:18 PM
this() can be used to invoke a constructor of the same class
super() can be used to invoke a super class constructor
aceamerican
02-06-2017, 05:07 AM
super() is used to call super class constructor, whereas this() used to call constructors in the same class, means to call parameterized constructors.
traveloweb
01-11-2018, 01:59 AM
1.Super is a keyword used to call constructor of the immediate parent class or access its properties . It is used to basically initialize the parent class. Super statement should always be first statement.
2.This keyword is used to access its own instance properties (since it can only access instance variables and methods). We can use this keyword anywhere we want as long as it does access some instance properties and used by object.
Powered by vBulletin® Version 4.2.2 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.