An object that refers to part of itself within its own methods can use which of the following reserved words to denote this relationship?
a) inner
b) self
c) private
d) this
e) static
Here is the solution,
I'm providing two solutions based on 1) JAVA and 2) Python
If the question is for JAVA then answer would be.... d) this
this keyword is used as reference to an object variables/methods
example:- this.name where name is a member variable of some class (eg:- student)
if the question is for Python then answer would be b) self
self keyword do the same what this keyword does in java. i.e reference to the object variables/methods
example :- self.name where name is a member variable of some class (eg:- student)
Thank you.
Get Answers For Free
Most questions answered within 1 hours.