Possible Duplicate:
this and super in java
I’m new to development. Something that I’m still unable to understand is the difference between this and super keywords. If there are any answers, it would be highly appreciated. Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In Java the keyword
thisrefers to the current object of a class, like in:In the constructor of the class
Pointthis.xrefers to thexdefined in the class, wherexis the parameter passed into the constructor. Herethisis used to resolve the ambiguity of the namex. The same thing is true fory.In the class
Point3Dthe methodtoString()uses the return value of the super classPointto produce its own return value.