+18

Qus:- What is the difference between this() and super() in Java?

#javaqueztions

5/14/2019 2:09:43 PM

Deepika Mourya

7 Answers

New Answer

+19

this refers to the current instance of the class and super refers to the constructor of the parent class

+14

this keyword: The this keyword can be used inside any method to refer to current object. For example: Box(double length,double breadth,double height) { this.length=length; this.breadth=breadth; this.height=height; }

+10

Super refers to the superclass that a class extends. this refers to the current instance of a class.

+9

https://www.google.de/amp/s/www.geeksforgeeks.org/super-and-this-keywords-in-java/amp/

+5

super() is used to call the Base class's(Parent class's) constructor. this() can be passed as an argument in the method call and that is Method or constructor is being invoked.

+4

As far as I see, you are posting these questions every day to earn sololearn badges. You already know these concepts and are still posting questions. It's more or less equivalent to spamming. Please don't spam Deepika Mourya

0

<7pnp?><bobbi>