Skip to content

Instantly share code, notes, and snippets.

@shipilev
Created February 12, 2020 16:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shipilev/2cecfb1a44cdf0910103ad0d4319b3e5 to your computer and use it in GitHub Desktop.
Save shipilev/2cecfb1a44cdf0910103ad0d4319b3e5 to your computer and use it in GitHub Desktop.
$ cat Test.java
public class Test {
int t1() {
int i1 = 1;
int i2 = 1;
return i1 + i2;
}
int t2() {
final int i1 = 1;
final int i2 = 1;
return i1 + i2;
}
}
$ javac Test.java
$ javap -c -p Test.class
Compiled from "Test.java"
public class Test {
public Test();
Code:
0: aload_0
1: invokespecial #1 // Method java/lang/Object."<init>":()V
4: return
int t1();
Code:
0: iconst_1
1: istore_1
2: iconst_1
3: istore_2
4: iload_1
5: iload_2
6: iadd
7: ireturn
int t2();
Code:
0: iconst_2
1: ireturn
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment