Java
Programming and Technical
Programming
Definition
Q. What is the difference between this() and super()?
A. This() can be used to invoke a constructor of the same class whereas super() can be used to invoke a super class constructor.
Read Solution (Total 3)
-
- this() is used to represent the present class variable. super() is used to represent parent class object
- 9 years agoHelpfull: Yes(0) No(0)
- this() is used to call the constructors of the same class and the methods of the same class, and when the instance and local variables have the same name.
super() is used to call the immediate parent class constructor and the parent class methods, and when the instance variables of the base and sub classes have the same name. - 9 years agoHelpfull: Yes(0) No(0)
- this():
it is used to call the constructor from the same class
super():
it is used to call the constructor from super class - 3 years agoHelpfull: Yes(0) No(0)
Java Other Question