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源码+清净的心地。
时间: 2024-10-29 15:52:01