string连接问题

String s1 ="hello"

String s2="world";

String s3= s1+s2在堆中建立了几个对象?

3个  因为+运算符会在堆中建立两个对象。

posted @ 2018-06-22 11:06  miss小张  阅读(80)  评论(0编辑  收藏  举报