Skip to content

Instantly share code, notes, and snippets.

@vaskoz
Created July 9, 2013 04:58
Show Gist options
  • Save vaskoz/5954821 to your computer and use it in GitHub Desktop.
Save vaskoz/5954821 to your computer and use it in GitHub Desktop.
Calling a static method is the one and only use case of invokestatic.
public class InvokeStatic {
public static void someStaticMethod() {}
public static void main(String[] args) {
someStaticMethod();
}
}
//Compiled from "InvokeStatic.java"
//public class InvokeStatic {
// public InvokeStatic();
// Code:
// 0: aload_0
// 1: invokespecial #1 // Method java/lang/Object."<init>":()V
// 4: return
//
// public static void someStaticMethod();
// Code:
// 0: return
//
// public static void main(java.lang.String[]);
// Code:
// 0: invokestatic #2 // Method someStaticMethod:()V
// 3: return
//}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment