Last active
May 24, 2016 03:20
-
-
Save sagnitude/03d0cc5a9f244b61f47e89e59f485587 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
class K { | |
private int c; | |
public int getC() { | |
return c; | |
} | |
public void setC(int c) { | |
this.c = c; | |
} | |
} |
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
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 | |
} |
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
class T { | |
public static void main(String[] args) { | |
K source = new K(); | |
K k = source; | |
k.getC(); | |
} | |
} |
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
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 | |
} |
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
class T2 { | |
public static void main(String[] args) { | |
K source = new K(); | |
K k; | |
k = source; | |
k.getC(); | |
} | |
} |
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
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 | |
} |
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
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