String s1=new String("Java"); /* 1st object created */
String s2="Tech"; /* 2nd Object */
s1+=s2; /* I'm confusing here whether new object created or result stored in previous object */
/*総どのように多くのオブジェクトを作成*/以下のコードでいくつのオブジェクトを作成しましたか? 4つのオブジェクトが作成さ
のみ2.コンパイル時に発生した場合。 – msagala25
この問題に関しては多くのSOの質問があります。投稿する前に検索しませんでしたか?次の項目を確認してください:http://stackoverflow.com/questions/47605/string-concatenation-concat-vs-operator http://stackoverflow.com/questions/3297867/difference-between-string-object-and-string-literal http://stackoverflow.com/questions/26083383/java-string-object-creation – Azodious
文字列は不変です。彼らは変わらない。あなたはいつも新しいものを手に入れます。 –