+ 20
Qus:- What is the difference between this() and super() in Java?
#javaqueztions
7 odpowiedzi
+ 21
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;
}
+ 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.
0
<7pnp?><bobbi>