?????????????

???????????????????????????????????StringBuffer????StringBuilder????String???????????????????????String?????????????????????????????????????ж?????????????????StringBuffer????StringBuilder???????????????????????е?StringBuffer????StringBuilder?????н??????????????????

public class Test3{
 public static void main (String [] args)
 {
  long time1Before=System.nanoTime();
  String str="";
  for(int i=0;i<10000;i++){
   str+=i;
  }
  long time1After=System.nanoTime();
  System.out.println("use String --->  "+(time1After-time1Before));

  long time2Before=System.nanoTime();
  StringBuilder sbuilder=new StringBuilder();
  for(int i=0;i<10000;i++){
   sbuilder.append(i);
  }
  long time2After=System.nanoTime();
  System.out.println("use StringBuilder--->  "+(time2After-time2Before));

  long time3Before=System.nanoTime();
  StringBuffer stringBuffer=new StringBuffer();
  for(int i=0;i<10000;i++){
   stringBuffer.append(i);
  }
  long time3After=System.nanoTime();
  System.out.println("use StringBuffer--->  "+(time3After-time3Before));
 }
}

????????????????StringBuffer??StringBuilder?????????????????????????????????????????????????????????仰?????????????????????????????????????????????????????StringBuilder --> StringBuffer --> String??

?????????????????????????????????Ч?????????????????д??????????????????Ч????????????????????????????????ν???????????????????????????????????????????????????????????????д??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????Ь?????????Ц~~????