P
P
programmerjava2016-03-14 11:19:02
Java
programmerjava, 2016-03-14 11:19:02

Difference between invokevirtual & invokespecial?

Hello! Am I understanding the difference between the two instructions correctly?
invokevirtual is used to call methods on an object, and a reference to the object that owns the class (aload i) is pushed onto the stack as a parameter. invokespecial is used to initialize a class and call private methods. In the case of calling private methods, a reference to the owner object (this) is always written to the stack with the aload 0 command.
Please respond to those who know. Thank you very much

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question