*
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 Murach's Java Servlets and JSP this week in the Servlets 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: 391
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

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