首页 > 代码库 > java拼接字符串用StringBuilder

java拼接字符串用StringBuilder

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

拼接字符串用stringbuilder,不要用string,测试下代码运行时间就知道了

java拼接字符串用StringBuilder