Created
May 25, 2016 23:33
-
-
Save trasa/ceac6517d99530a94a70c6337c57bd97 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
import java.util.*; | |
public class Initials { | |
private String foo = null; | |
private int i = 0; | |
private Map<String, Integer> map = null; | |
} |
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 "Initials.java" | |
public class Initials { | |
public Initials(); | |
Code: | |
0: aload_0 | |
1: invokespecial #1 // Method java/lang/Object."<init>":()V | |
4: aload_0 | |
5: aconst_null | |
6: putfield #2 // Field foo:Ljava/lang/String; | |
9: aload_0 | |
10: iconst_0 | |
11: putfield #3 // Field i:I | |
14: aload_0 | |
15: aconst_null | |
16: putfield #4 // Field map:Ljava/util/Map; | |
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
Compiled from "NotInitials.java" | |
public class NotInitials { | |
public NotInitials(); | |
Code: | |
0: aload_0 | |
1: invokespecial #1 // Method java/lang/Object."<init>":()V | |
4: 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
import java.util.*; | |
public class NotInitials { | |
private String foo; | |
private int i; | |
private Map<String, Integer> map; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Setting the fields to null (or their default) causes the fields to be initialized twice. This isn't the end of the world and is unlikely to break your application (and might even be optimized away when the app starts?) but, still.