Java?????????????????
???????????? ???????[ 2013/6/9 13:30:33 ] ????????
?????????????
???????????????????????????????????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??
?????????????????????????????????Ч?????????????????д??????????????????Ч????????????????????????????????ν???????????????????????????????????????????????????????????????д??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????Ь?????????Ц~~????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11