Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Prabhat Ranjan
Ranch Hand
Posts: 397
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

}
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic