+ 1

Can anybody explain "this" and "super" keywords in java

7th Oct 2017, 1:18 PM
Prasad Kumar Dasari
Prasad Kumar Dasari - avatar
3 Answers
+ 4
this() will give you the instance of current class. super() gives you the instance of immediate parent class. If you are using these keywords in constructor, you can either use this() or super() and not both simultaneously because they both must be the first line of the constructor.
7th Oct 2017, 1:47 PM
Anuj Khetan
Anuj Khetan - avatar
+ 1
thank you
9th Oct 2017, 1:55 PM
Prasad Kumar Dasari
Prasad Kumar Dasari - avatar