????2??String????巽??
??????????String????巽?????????????3?????????????????????????????????????????????????????????ɡ?
??????????(constant pool)??????????????????????????????????.class????е??Щ?????????????????????????????е??????????????????????????????????????????????????μ??????????У?String???intern()???????????????????á???????????????intern?????????????????????????????????????????????????????ó?????????????????????????(string??integer??float????)??????????????κ????????????????????????????????????????????
????String????巽??????????????????????
??????ù????new???磺String s1 = new String(“myString”);
?????????壬?磺String s1 = “myString”;
??????????????磺String s1 = “my” + “String”;?????????????????????????μ?java–String???????????????????
???????????????????new?????????????????????????????????????????飬??????“myString”??????????????????????п?????????????“myString”???????????????????????????????????????????“myString”????????????????????????п??????????new??????String?????????п?????????????“s1”????????????String??????????????????????????s1???new??????String???????λ??????????????????new?????????????????е?“myString”?????????????????????????????巽???????????????????
??????????????????????????????????????????????????????飬??????“myString”??????????????????????п?????????????“myString”?????????????????????????????????п?????????????“s1”????????????????“myString”????????????????е??????????????е?String????????????????????????????????????????String??????????????
?????????????????????????????????String????????????String????????????????????????????????????????????????
???????????????????????????????????String??????????????????????????????????д???????????String???????????String s1 = new String(“myString”);????????????????????????????String????????clone?????String????洢????У?????s1?????е?????????????????е??????б????á??????????String s1 = “myString”;?????????????????“myString”???????????s1????????е????????????????????????????????s1???????????????????
???????????????????????е????????????????????String?????????е?String????????????
??????????????????????????????????·????????????Щ??????????????????á?JAVA String????????????????????????????????
???????????Σ???????????????????”myString”????????????????????????б??в??????????????????????????洴????????????????[myString]??String????s1???????????????к?????String????????????( [myString]?? s1 )???浽?????????????б??С???????????

????????????????????????????????????????myString????????????????????????б?????????????????У??????????String????????á???????????б???????κ???????????????????б??????????Ρ?
???????磬String s2 = “myString”???????s2????????????????б?????s1????????????s2??s1?????????String????
??????????????????????????????????????????????????????????????????????δ??????н????javaer??????????
????String s1 = new String(“myString”);
????String s2 = “myString”;
????System.out.println(s1 == s2);  //????????????????????????????true??????????????????false?????s1?????????String??????s2????????????е?String??????

??????????????????????????????????????????????——??????????б?????????????????????????
?????????????????????????????????????????????????????????????????лл??
????????new?????????????????е?“myString”??????????
???????????е??????????????е?String???????????????
?????????????????????????????String??????????????
????3??String??StringBuffer??StringBuilder???????????
?????????????????String???????????????StringBuffer??StringBuilder??
????StringBuffer??StringBuilder????????????AbstractStringBuilder????????????String??????????char[] value??int count????????String???????????????final???η??????ó??????String??StringBuffer??StringBuilder????????????????飬???????????????????????String??η???????μ?String???????StringBuffer??StringBuilder??append??????????this?????????????????д???????????????????????????String???????StringBuffer??StringBuilder?????????????????StringBuffe????????????StringBuilder???
????????StringBuffer??StringBuilder??????????????????????????append()??????????

?????????????StringBuffer??append()?????????????????StringBuilder??append()????????????????????StringBuffer?????????????synchronized???Σ????????????????????????????á??????????????????????Ч??????????????????????????StringBuffer?????????????????????????????StringBuilder??????Ч??????