Java?г??????
???????????? ???????[ 2014/7/17 11:18:36 ] ????????Java ???????
????????
????Java??????????????????????????????????????????????????????Щ???????????????Щ??????????????????????????п?????????????????????????????????Java ?????????????Щ???
???????????????? ?????????????
?????????????????????????????????????????s???????????????????????????????????????á?
????String s = "Hello";
??????????????????????磺 ????:??????? ???????????????????????? s+=“??” ?????Java??????????????????????????
????==???????????????????
????????????????????????==???????????????????????????????????JVM???????? ???????? ??
????String s1 = "Hi"?? s2 = "Hi";
????Integer a = 12?? b = 12;
??????????????????????????????????? ????????????s1==s2??a==b???????true??JVM????????????? ?????????????????????????????′???JVM??а??????????????==????false??????????????????????????????equals???
????String s3 = new String(s1);
????Integer c = -222?? d = -222;
????s1 == s2 // is true
????s1 == s3 // is false
????s1.equals(s3) // is true
????a == b // is true
????c == d // is false (different objects were created)
????c.equals(d) // is true
???????????????????????????Χ??-128??127?????п?????????
????Java?????????????????
???????е???????????????????á????????????и??????????????????????????????????????????Σ??????????????????????
????public static void addAWord(StringBuilder sb) {
????sb.append(" word");
????sb = null;
????}
????StringBuilder sb = new StringBuilder("first ");
????addWord(sb);
????addWord(sb);
????System.out.println(sb); // prints "first word word"
????????????????????????????????????????????÷???????????
??????????JVM?????Object.hashCode??????????
????hashCode????????????????????HashSet????ConcurrentHashMap?????????????????????????κε????????????λ??????????仯????????????????????????????????????????hashCode??????е????????????????JVM??????????????????? ???? OpenJDK??Hotspot JVM?????hashCode??????????????洢??????????????Unsafe API????hashCode??????????????????????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11