日期:2014-05-20 浏览次数:21644 次
public static void main(String args[]) { int length = 1; StringBuffer sb = new StringBuffer(length); for (int i = length; i < 7; i++) { sb.append(" "); } System.out.println(sb.toString() + "!!!"); }
------解决方案--------------------
[code=Java][/code]
StringBuffer sb=new StringBuffer("aaa");
for(int i=3;i<7;i++){
sb.append(" ");
}
sb.toString();
System.out.println(sb+"!!!");
}
[/code]
结果:[code=Java]
aaa !!!