I’m trying to get an understanding of what the the java keyword this actually does. I’ve been reading Sun’s documentation but I’m still fuzzy on what this actually does.
I’m trying to get an understanding of what the the java keyword this actually
Share
The
thiskeyword is a reference to the current object.Another way to think about it is that the
thiskeyword is like a personal pronoun that you use to reference yourself. Other languages have different words for the same concept. VB usesMeand the Python convention (as Python does not use a keyword, simply an implicit parameter to each method) is to useself.If you were to reference objects that are intrinsically yours you would say something like this:
Think of
thisas just a way for a type to say ‘my’. So a psuedocode representation would look like this: