Log in

View Full Version : What is the difference between super() and this()?



priya01
06-03-2016, 02:45 AM
What is the difference between super() and this()?



introduction to programming (https://gogotraining.com/training/courses/287/introduction-to-programming-and-coding-for-everyone-with-javascript/) oracle dba training (https://gogotraining.com/training/courses/288/oracle-12c-database-administration-i-part-1/) java se 8 programming (https://gogotraining.com/training/courses/306/java-se-8-programming-part-1/) itil service operation training (https://gogotraining.com/training/courses/237/itil-2011-service-operation--axelos-and-exin-accredited-training/)

Sherin
04-10-2019, 05:19 AM
super() as well as this() both are used to make constructor calls.
super() is used to call Base class's constructor(i.e, Parent's class) while this() is used to call current class's constructor.
If you use this() and super() together in a constructor it will give compile time error.

Servers Base
05-03-2019, 10:52 AM
super() as well as this() both are used to make constructor calls.
super() is used to call Base class's constructor(i.e, Parent's class) while this() is used to call current class's constructor.
super() is used to call Base class's(Parent class's) constructor.

vashimantra
05-16-2019, 02:34 AM
Thanks for show your interest