Last active
October 16, 2018 15:05
-
-
Save jayden-lee/222dbf1e161765c5e03c23761a0df4b8 to your computer and use it in GitHub Desktop.
"" 또는 생성자를 이용한 Java 문자열 생성
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
String s1 = "Hello, gglee"; | |
String s2 = new String("Hello, gglee"); |
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
String c = new String("abcd"); | |
String d = new String("abcd"); | |
System.out.println(c == d); // false | |
System.out.println(c.equals(d)); // true |
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
String c = new String("abcd").intern(); | |
String d = new String("abcd").intern(); | |
System.out.println(c == d); // true | |
System.out.println(c.equals(d)); // true |
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
String a = "abcd"; | |
String b = "abcd"; | |
System.out.println(a == b); // true | |
System.out.println(a.equals(b)); // true |
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
String a = "abcd"; | |
String c = new String("abcd").intern(); | |
System.out.println(a == c); // true | |
System.out.println(a.equals(c)); // true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment