+ 20

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

#javaqueztions

14th May 2019, 2:09 PM
Deepika Mourya
Deepika Mourya - avatar
5 odpowiedzi
+ 21
this refers to the current instance of the class and super refers to the constructor of the parent class
15th May 2019, 8:24 AM
Nour Abu Assaf
Nour Abu Assaf - avatar
+ 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; }
17th May 2019, 12:57 PM
Yamin Mansuri
Yamin Mansuri - avatar
+ 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.
15th May 2019, 8:17 PM
Samila Chanuka
Samila Chanuka - avatar
0
<7pnp?><bobbi>
24th May 2019, 9:26 PM
Alex Mel