java 字符串拼接为何不能用null

本身写代码的时候,第一次用String str= null;而后去拼接字符串,在查询的时候报错,debug检查出来,最终的参数字符串str里面竟然有null,如图:java   因此拼接字符串不能用null,缘由以下:debug s = s+"word"; 等价于 s = String.valueOf(s)+"word";  Integer,Double都同样。code //jdk源码 publi
相关文章
相关标签/搜索