When does StringBuffer adds strings to the String Pool?

前端 未结 4 1554
失恋的感觉
失恋的感觉 2020-12-20 10:19

When I define a StringBuffer variable with new, this string is not added to the String pool, right?

Now, when I define another String

4条回答
  •  遥遥无期
    2020-12-20 10:34

    Actually your teacher is referring to XXX . which goes to StringPool because all string literals written in java program goes to StringPool while execution...

提交回复
热议问题