5.9-4用字符串生成器给字符串str追加1~10这10个数字
1 package zfc; 2 3 public class ZfcShcq { 4 5 public static void main(String[] args) { 6 // TODO Auto-generated method stub 7 8 9 StringBuilder str = new StringBuilder("hello world!"); 10 11 for(int i = 1; i <= 10; i++) 12 { 13 str.append(i); 14 } 15 16 System.out.println("字符串str追加后变为:"+str); 17 18 } 19 20 }