标签:java tostring release pack ges pac ret UI public
os :windows7 x64
jdk:jdk-8u131-windows-x64
ide:Eclipse Oxygen Release (4.7.0)
code:
package jizuiku0; public class Demo10 { public static void main(String[] args) { StringBuffer sb = new StringBuffer(); sb.append("cnblog_"); sb.append("jizuiku"); String str = sb.toString(); System.out.println(str); } }
result:
sourceCode:
@Override public synchronized String toString() { if (toStringCache == null) { toStringCache = Arrays.copyOfRange(value, 0, count); } return new String(toStringCache, true); }
Java优秀,值得学习。
学习资源:API手册+Java源码+清净的心地。
JavaSE8基础 StringBuffer toString 将其转为String对象
标签:java tostring release pack ges pac ret UI public
原文地址:http://www.cnblogs.com/jizuiku/p/7469604.html