Monday 14 November 2011

how invoking statement creates link with the method . { Java }

hello friends i am tushar , and i just want to explain an interesting topic , which is very interesting in my sense . but i am not sure about you . this concept of method invocation is applied in all languages . means every langauage has similar type of statement so reading this topic and learning something from here never creates a junk in you mind because for a programmer it is very important to learn to all these things .

so i want to explain some thing which is totally cleared from the following image ...

so from this figure , i want to explain that between the method and invocation part there is a arrow , so the question is that who is behind this arrow or i want to find the linker between method invocation statement and method .

so behind this there is a method , "invokeExact" method which plays a important role in linking the statement and the method . so how the process works ...

before every thing you have to learn something about machine representation of java program or something about some instructions like invokevirtual / invokespecial / invokestatic .so look when i make a simple program of linking a invocation statement and method .

now see a machine representation of this figure or you can say at run time what is the state of this program .

so for your kind information i want to tell you that compiler never connects or works as a linker . for this compiler just create a instruction which can be invokespecial / invokevirtual / invokestatic . and when ever there is a statement like invoke , it makes a call to " invokeExact " which is a method . and now the task of invoke method starts who is the linker between these two .

so the syntax of invokeExact is "invokeExact(object, methodName, args);" so ... invokeExact is the cause behind linking in java ..

for more information use this link "
http://commons-beanutils.sourcearchive.com/documentation/1.8.0/classorg_1_1apache_1_1commons_1_1beanutils_1_1MethodUtils_f4ce95949171d8df38555ba441a1cc51.html"

No comments: