1. 程式人生 > >java拼接字符串用StringBuilder

java拼接字符串用StringBuilder

div for builder int code clas end 拼接 uil

    StringBuilder builder = new StringBuilder();
        String s1="abc";
        
        for(int i=0;i<10000000;i++)
        {
            builder.append(s1);
        }

拼接字符串用stringbuilder,不要用string,測試下代碼運行時間就知道了

java拼接字符串用StringBuilder