Skip to content

Instantly share code, notes, and snippets.

@sagnitude
Last active May 24, 2016 03:20
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 sagnitude/03d0cc5a9f244b61f47e89e59f485587 to your computer and use it in GitHub Desktop.
Save sagnitude/03d0cc5a9f244b61f47e89e59f485587 to your computer and use it in GitHub Desktop.
class K {
private int c;
public int getC() {
return c;
}
public void setC(int c) {
this.c = c;
}
}
Compiled from "T.java"
class T {
T();
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 K, new K() start
3: dup
4: invokespecial #3 // Method K."<init>":()V
7: astore_1 // source = new K()
8: aload_1 // new K() end, prepare `source`
9: astore_2 // k = source;
10: aload_2 // prepare `k`
11: invokevirtual #4 // Method K.getC:()I
14: pop
15: return
}
class T {
public static void main(String[] args) {
K source = new K();
K k = source;
k.getC();
}
}
Compiled from "T2.java"
class T2 {
T2();
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 K
3: dup
4: invokespecial #3 // Method K."<init>":()V
7: astore_1
8: aload_1
9: astore_2
10: aload_2
11: invokevirtual #4 // Method K.getC:()I
14: pop
15: return
}
class T2 {
public static void main(String[] args) {
K source = new K();
K k;
k = source;
k.getC();
}
}
Compiled from "T3.java"
class T3 {
static K k;
T3();
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 K
3: dup
4: invokespecial #3 // Method K."<init>":()V
7: astore_1
8: aload_1
9: putstatic #4 // Field k:LK;
12: getstatic #4 // Field k:LK;
15: invokevirtual #5 // Method K.getC:()I
18: pop
19: return
}
class T3 {
static K k;
public static void main(String[] args) {
K source = new K();
k = source;
k.getC();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment