Created
April 14, 2014 17:54
-
-
Save oscarryz/10669371 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat Hello.java | |
class Hello { | |
public static void main(String ... args) { | |
Hello hello = new Hello(); | |
hello.test(); | |
} | |
public void test() { | |
runIt(() -> this.something()); | |
} | |
public void runIt(Runnable r) { | |
r.run(); | |
} | |
public void something() { | |
System.out.println("Hello world"); | |
} | |
} | |
$javap -c Hello | |
Compiled from "Hello.java" | |
class Hello { | |
Hello(); | |
Code: | |
0: aload_0 | |
1: invokespecial #1 // Method java/lang/Object."<init>":()V | |
4: return | |
public static void main(java.lang.String...); | |
Code: | |
0: new #2 // class Hello | |
3: dup | |
4: invokespecial #3 // Method "<init>":()V | |
7: astore_1 | |
8: aload_1 | |
9: invokevirtual #4 // Method test:()V | |
12: return | |
public void test(); | |
Code: | |
0: aload_0 | |
1: aload_0 | |
2: invokedynamic #5, 0 // InvokeDynamic #0:run:(LHello;)Ljava/lang/Runnable; | |
7: invokevirtual #6 // Method runIt:(Ljava/lang/Runnable;)V | |
10: return | |
public void runIt(java.lang.Runnable); | |
Code: | |
0: aload_1 | |
1: invokeinterface #7, 1 // InterfaceMethod java/lang/Runnable.run:()V | |
6: return | |
public void something(); | |
Code: | |
0: getstatic #8 // Field java/lang/System.out:Ljava/io/PrintStream; | |
3: ldc #9 // String Hello world | |
5: invokevirtual #10 // Method java/io/PrintStream.println:(Ljava/lang/String;)V | |
8: return | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment