Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java implicit "this" parameter in method?

Tags:

java

methods

this

Within the programming language Java do method invocations on an object, work by implicitly passing a reference to the object to act on and working as static methods?

like image 462
poulter7 Avatar asked Apr 21 '11 00:04

poulter7


1 Answers

Details on how method invocation works can be found in the Java SE 7 JVM specification, section 3.7. For an instance method the this reference is passed as the first parameter. This reference is also used to select which method to invoke, since it might be overridden in a subclass, so it is a bit more complicated than a static method.

like image 188
Jörn Horstmann Avatar answered Nov 06 '22 16:11

Jörn Horstmann