wood burning stoves 2.0*
The moose likes Java in General and the fly likes Difference between invokeVirtual , invokeSpecial and invokeStatic in bytecode of java src file. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Difference between invokeVirtual , invokeSpecial and invokeStatic in bytecode of java src file." Watch "Difference between invokeVirtual , invokeSpecial and invokeStatic in bytecode of java src file." New topic
Author

Difference between invokeVirtual , invokeSpecial and invokeStatic in bytecode of java src file.

Prabhat Ranjan
Ranch Hand

Joined: Oct 04, 2006
Posts: 387
Anyone has idea about this difference keyword used in bytecode.


class test extends java.lang.Object{
test();
Code:
0: aload_0
1: invokespecial #1; //Method java/lang/Object."<init>")V
4: return

public static void main(java.lang.String[]) throws java.lang.ClassNotFoundException, java.lang.InstantiationException, java.lang.IllegalAccessException;
Code:
0: ldc #2; //String java.lang.String
2: invokestatic #3; //Method java/lang/Class.forNameLjava/lang/String;)Ljava/lang/Class;
5: invokevirtual #4; //Method java/lang/Class.newInstance)Ljava/lang/Object;
8: pop
9: new #5; //class java/lang/String
12: dup
13: invokespecial #6; //Method java/lang/String."<init>")V
16: astore_1
17: return

}
 
 
subject: Difference between invokeVirtual , invokeSpecial and invokeStatic in bytecode of java src file.
 
Similar Threads
string question
Help with returning one string from three methods of type string?
Is System.out.println method calling toString() by default? A strange behavior.
When to use new and newInstance() and what is the difference bet them.
String literal objects in String pool