{"id":56,"date":"2015-03-30T09:19:35","date_gmt":"2015-03-30T01:19:35","guid":{"rendered":"https:\/\/ai.zhousir.top\/?p=56"},"modified":"2026-08-18T12:09:24","modified_gmt":"2026-08-18T04:09:24","slug":"string%e5%92%8cstringbuffer","status":"publish","type":"post","link":"https:\/\/ai.zhousir.top\/?p=56","title":{"rendered":"String\u548cStringBuffer"},"content":{"rendered":"<section id=\"wenyan\" style=\"font-family: system-ui, 'Apple Color Emoji', 'Segoe UI', 'Segoe UI Symbol', 'Noto Sans', Roboto, sans-serif; line-height: 1.75; font-size: 16px; color: #000000; caret-color: #000000;\" data-provider=\"WenYan\">\n<p style=\"margin: 1em 0px;\"><code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">String<\/code> \u7684\u503c\u4e0d\u53ef\u53d8\uff0c\u6bcf\u6b21\u64cd\u4f5c\u90fd\u4f1a\u751f\u6210\u65b0\u5bf9\u8c61\uff0c\u65e2\u6162\u53c8\u8d39\u5185\u5b58\u3002<\/p>\n<p style=\"margin: 1em 0px;\"><code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">StringBuffer<\/code> \u540c\u6837\u8868\u793a\u5b57\u7b26\u4e32\uff0c\u4f46\u5185\u90e8\u5b9e\u73b0\u4e0d\u540c\uff1a\u4fee\u6539\u65f6\u5c3d\u91cf\u5728\u539f\u7f13\u51b2\u533a\u4e0a\u52a8\u624b\uff0c\u4e0d\u6025\u7740\u9020\u65b0\u5bf9\u8c61\uff0c\u5185\u5b58\u4e0a\u901a\u5e38\u4f18\u4e8e String\u3002<\/p>\n<p><!--more--><\/p>\n<p style=\"margin: 1em 0px;\">StringBuffer \u9ed8\u8ba4\u5206\u914d 16 \u4e2a\u5b57\u7b26\u7684\u7f13\u51b2\u533a\uff0c\u5185\u5bb9\u8d85\u51fa\u65f6\u81ea\u52a8\u6269\u5bb9\uff0c\u800c\u4e0d\u662f\u6bcf\u6b21\u90fd\u6362\u4e00\u4e2a\u5168\u65b0\u5bf9\u8c61\u3002\u5b83\u4e0d\u50cf String \u90a3\u6837\u652f\u6301\u5b57\u9762\u91cf\u7b80\u5199\uff0c\u53ea\u80fd <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">new<\/code>\uff1a<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 12px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 12px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; margin: 0.5em; padding: 3px 5px; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">StringBuffer str1 = new StringBuffer(); \/\/ \u9ed8\u8ba4 16 \u4e2a\u5b57\u7b26\u7684\u7f13\u51b2\u533a\nStringBuffer str2 = new StringBuffer(512); \/\/ \u5bb9\u91cf 512\n\/\/ \u653e\u5165\u5b57\u7b26\u4e32\uff0c\u5e76\u5728\u540e\u9762\u9884\u7559 16 \u4e2a\u5b57\u7b26\u7684\u7a7a\u4f59\nStringBuffer str3 = new StringBuffer(\"www.scxh.com\");<\/code><\/pre>\n<h2 style=\"padding: 1px 12.5px; color: #ffffff; margin: 1.2em 0px 1em; border-radius: 4px; display: inline-block; background-color: #4870ac; font-size: 1.3em;\">\u4e00\u3001StringBuffer \u5e38\u7528\u65b9\u6cd5<\/h2>\n<p style=\"margin: 1em 0px;\">\u65b9\u6cd5\u504f\u91cd\u8ffd\u52a0\u3001\u63d2\u5165\u3001\u5220\u9664\u3002\u5b9e\u9645\u5f00\u53d1\u91cc\u5982\u679c\u8981\u5bf9\u540c\u4e00\u6bb5\u5185\u5bb9\u9891\u7e41\u6539\u52a8\uff0c\u4f18\u5148\u7528 StringBuffer\uff08\u5355\u7ebf\u7a0b\u53ef\u6539\u7528 StringBuilder\uff09\u3002<\/p>\n<h3 style=\"padding: 0px; color: #4870ac; margin: 1.2em 0px 1em; font-size: 1.3em;\">1\uff09append()<\/h3>\n<p style=\"margin: 1em 0px;\"><code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">append()<\/code> \u5f80\u5f53\u524d\u5185\u5bb9\u672b\u5c3e\u8ffd\u52a0\uff0c\u8c03\u7528\u540e\u5bf9\u8c61\u672c\u8eab\u53d8\u4e86\uff0c\u4e0d\u662f\u6362\u4e86\u4e00\u4e2a\u5f15\u7528\uff1a<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 12px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 12px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; margin: 0.5em; padding: 3px 5px; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">StringBuffer str = new StringBuffer(\"biancheng100\");\nstr.append(true); \/\/ \u5185\u5bb9\u53d8\u6210 biancheng100true<\/code><\/pre>\n<p style=\"margin: 1em 0px;\">\u5b57\u7b26\u4e32\u7684 <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">+<\/code> \u5728\u7f16\u8bd1\u671f\u4f1a\u8f6c\u6210\u53ef\u53d8\u7f13\u51b2\u518d <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">append()<\/code>\uff0c\u6700\u540e <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">toString()<\/code>\u3002\u65e9\u671f javac \u7528\u7684\u662f StringBuffer\uff0c\u8f83\u65b0\u7684\u7f16\u8bd1\u5668\u591a\u7528 StringBuilder\u3002\u5faa\u73af\u91cc\u53cd\u590d <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">str += fragment<\/code> \u4ecd\u4f1a\u4e0d\u65ad\u4ea7\u751f\u4e2d\u95f4 String\uff0c\u6548\u7387\u8fdc\u5dee\u4e8e\u81ea\u5df1\u6301\u6709\u4e00\u4e2a Buffer\u3002\u77ed\u5b57\u7b26\u4e32\u7528 <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">+<\/code> \u66f4\u76f4\u89c2\uff0c\u53ef\u4ee5\u7a0d\u5fae\u727a\u7272\u6548\u7387\u6362\u53ef\u8bfb\u6027\u3002<\/p>\n<h3 style=\"padding: 0px; color: #4870ac; margin: 1.2em 0px 1em; font-size: 1.3em;\">2\uff09deleteCharAt() \/ delete()<\/h3>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 12px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 12px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; margin: 0.5em; padding: 3px 5px; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">StringBuffer str = new StringBuffer(\"abcdef\");\nstr.deleteCharAt(3); \/\/ \u5220\u6389\u7d22\u5f15 3 \u7684 'd'\uff0c\u5269\u4e0b abcef\nstr = new StringBuffer(\"abcdef\");\nstr.delete(1, 4);    \/\/ \u5220 [1, 4)\uff0c\u5373 bcd\uff0c\u5269\u4e0b aef<\/code><\/pre>\n<h3 style=\"padding: 0px; color: #4870ac; margin: 1.2em 0px 1em; font-size: 1.3em;\">3\uff09insert()<\/h3>\n<p style=\"margin: 1em 0px;\">\u5728\u6307\u5b9a\u4f4d\u7f6e\u63d2\u5165\uff0c\u53ef\u4ee5\u770b\u6210 append \u7684\u5347\u7ea7\u7248\u3002\u7d22\u5f15 3 \u662f <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">'d'<\/code> \u524d\u9762\uff0c\u6240\u4ee5\u63d2\u5165\u540e\u662f <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">abcxyzdef<\/code>\uff08\u539f\u6587\u5199\u6210 abcdxyzef\uff0c\u4f4d\u7f6e\u7b97\u9519\u4e86\uff09\uff1a<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 12px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 12px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; margin: 0.5em; padding: 3px 5px; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">StringBuffer str = new StringBuffer(\"abcdef\");\nstr.insert(3, \"xyz\"); \/\/ abcxyzdef<\/code><\/pre>\n<h3 style=\"padding: 0px; color: #4870ac; margin: 1.2em 0px 1em; font-size: 1.3em;\">4\uff09setCharAt()<\/h3>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 12px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 12px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; margin: 0.5em; padding: 3px 5px; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">StringBuffer str = new StringBuffer(\"abcdef\");\nstr.setCharAt(3, 'z'); \/\/ abczef<\/code><\/pre>\n<p style=\"margin: 1em 0px;\">\u4ee5\u4e0a\u53ea\u662f\u5e38\u7528\u65b9\u6cd5\uff0c\u5b8c\u6574\u5217\u8868\u770b API \u6587\u6863\u3002<\/p>\n<h2 style=\"padding: 1px 12.5px; color: #ffffff; margin: 1.2em 0px 1em; border-radius: 4px; display: inline-block; background-color: #4870ac; font-size: 1.3em;\">\u4e8c\u3001\u6548\u7387\u5bf9\u6bd4<\/h2>\n<p style=\"margin: 1em 0px;\">\u628a 26 \u4e2a\u82f1\u6587\u5b57\u6bcd\u62fc\u63a5 10000 \u6b21\uff0c\u5dee\u5f02\u4f1a\u975e\u5e38\u660e\u663e\uff1a<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 12px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 12px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; margin: 0.5em; padding: 3px 5px; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">public class Demo {\n    public static void main(String[] args) {\n        String fragment = \"abcdefghijklmnopqrstuvwxyz\";\n        int times = 10000;\n\n        long timeStart1 = System.currentTimeMillis();\n        String str1 = \"\";\n        for (int i = 0; i < times; i++) {\n            str1 += fragment;\n        }\n        long timeEnd1 = System.currentTimeMillis();\n        System.out.println(\"String: \" + (timeEnd1 - timeStart1) + \"ms\");\n\n        long timeStart2 = System.currentTimeMillis();\n        StringBuffer str2 = new StringBuffer();\n        for (int i = 0; i < times; i++) {\n            str2.append(fragment);\n        }\n        long timeEnd2 = System.currentTimeMillis();\n        System.out.println(\"StringBuffer: \" + (timeEnd2 - timeStart2) + \"ms\");\n    }\n}\n\/\/ \u539f\u6587\u673a\u5668\u4e0a\u7684\u4e00\u6b21\u7ed3\u679c\uff1a\n\/\/ String: 5287ms\n\/\/ StringBuffer: 3ms<\/code><\/pre>\n<p style=\"margin: 1em 0px;\">\u53e0\u52a0 30000 \u6b21\u65f6\uff0c\u539f\u6587\u6d4b\u5230 String \u7ea6 35923ms\u3001StringBuffer \u7ea6 8ms\u3002\u6b21\u6570\u8d8a\u591a\uff0c\u5dee\u8ddd\u8d8a\u5927\u3002\u5927\u91cf\u62fc\u63a5\u8bf7\u7528 Buffer \/ Builder\u3002<\/p>\n<h2 style=\"padding: 1px 12.5px; color: #ffffff; margin: 1.2em 0px 1em; border-radius: 4px; display: inline-block; background-color: #4870ac; font-size: 1.3em;\">\u4e09\u3001StringBuilder \u4e0e\u9009\u578b<\/h2>\n<p style=\"margin: 1em 0px;\">StringBuilder \u548c StringBuffer \u529f\u80fd\u3001\u65b9\u6cd5\u51e0\u4e4e\u4e00\u6837\uff1aBuffer <strong style=\"color: #4870ac;\">\u7ebf\u7a0b\u5b89\u5168<\/strong>\uff0cBuilder <strong style=\"color: #4870ac;\">\u975e\u7ebf\u7a0b\u5b89\u5168<\/strong>\uff0c\u5355\u7ebf\u7a0b\u65f6 Builder \u7565\u5feb\u3002\u4e09\u8005\u90fd\u5b9e\u73b0\u4e86 <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">CharSequence<\/code>\uff08<code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">length()<\/code>\u3001<code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">charAt<\/code>\u3001<code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">subSequence<\/code>\uff09\u3002String \u76f4\u63a5\u5b9e\u73b0\u8be5\u63a5\u53e3\uff1bBuilder \u548c Buffer \u90fd\u662f\u53ef\u53d8\u5e8f\u5217\uff0c\u7ee7\u627f <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">AbstractStringBuilder<\/code>\u3002<\/p>\n<table style=\"display: table; text-align: left; overflow: auto; border-collapse: collapse; margin: 1.4em auto; max-width: 100%; table-layout: fixed; overflow-wrap: break-word; word-break: break-all;\" width=\"800\">\n<thead>\n<tr>\n<th style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top; text-align: center; font-weight: bold; color: #4870ac; background: #f7f7f7;\">\u7c7b\u578b<\/th>\n<th style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top; text-align: center; font-weight: bold; color: #4870ac; background: #f7f7f7;\">\u53ef\u53d8<\/th>\n<th style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top; text-align: center; font-weight: bold; color: #4870ac; background: #f7f7f7;\">\u7ebf\u7a0b\u5b89\u5168<\/th>\n<th style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top; text-align: center; font-weight: bold; color: #4870ac; background: #f7f7f7;\">\u9002\u7528<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">String<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u5426<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u662f\uff08\u4e0d\u53ef\u53d8\u672c\u8eab\u5b89\u5168\uff09<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u5c11\u91cf\u6570\u636e\u3001\u5b57\u9762\u91cf<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">StringBuilder<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u662f<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u5426<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u5355\u7ebf\u7a0b\u5927\u91cf\u62fc\u63a5\uff08\u901a\u5e38\u6700\u5feb\uff09<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">StringBuffer<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u662f<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u662f<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u591a\u7ebf\u7a0b\u5927\u91cf\u62fc\u63a5<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"margin: 1em 0px;\">\u901f\u5ea6\u5927\u81f4\u662f StringBuilder &gt; StringBuffer &gt; String\uff0c\u8fd9\u662f\u76f8\u5bf9\u503c\uff0c\u4e0d\u662f\u7edd\u5bf9\u5b9a\u5f8b\u3002<\/p>\n<blockquote style=\"display: block; font-size: 0.9em; border-left: 3px solid #4870ac; padding: 0.5em 1em; margin: 0px; background: #f6f8fa; color: #40464f;\">\n<p style=\"margin: 1em 0px;\"><strong style=\"color: #4870ac;\">\u4e00\u53e5\u8bdd\u603b\u7ed3\uff1a\u5c11\u91cf\u7528 String\uff1b\u5355\u7ebf\u7a0b\u5927\u91cf\u6539\u7528 StringBuilder\uff1b\u591a\u7ebf\u7a0b\u5927\u91cf\u6539\u7528 StringBuffer\u3002<\/strong><\/p>\n<\/blockquote>\n<\/section>\n","protected":false},"excerpt":{"rendered":"<p>String \u7684\u503c\u4e0d\u53ef\u53d8\uff0c\u6bcf\u6b21\u64cd\u4f5c\u90fd\u4f1a\u751f\u6210\u65b0\u5bf9\u8c61\uff0c\u65e2\u6162\u53c8\u8d39\u5185\u5b58\u3002 StringBuffer \u540c\u6837\u8868\u793a\u5b57\u7b26\u4e32\uff0c\u4f46 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[15],"tags":[29,30],"_links":{"self":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/56"}],"collection":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=56"}],"version-history":[{"count":3,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/56\/revisions"}],"predecessor-version":[{"id":2367,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/56\/revisions\/2367"}],"wp:attachment":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=56"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=56"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=56"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}