日期:2014-05-20  浏览次数:21373 次

StringBuffer为什么不能append换行符.
我用sb.append( "\n ");
这样的语句总是不能换行.

------解决方案--------------------
public class TestStringBuffer{
public static void main(String[] args){
StringBuffer sb=new StringBuffer( "hello ");
//sb.append( "\n ");
String another= "world ";
System.out.println(sb.toString());
System.out.println(another);
}
}
我试了一下,应该可以的。
------解决方案--------------------
jdk1.6
\n
\n\r
都没有问题