{"id":386,"date":"2023-07-11T14:21:00","date_gmt":"2023-07-11T05:21:00","guid":{"rendered":"https:\/\/www.kd2.jp\/memo3\/?p=386"},"modified":"2023-07-11T14:56:39","modified_gmt":"2023-07-11T05:56:39","slug":"%e6%96%87%e5%ad%97%e5%88%97%e9%96%93%e3%81%ae-%e3%80%8c%e3%80%8d-%e6%bc%94%e7%ae%97%e5%ad%90","status":"publish","type":"post","link":"https:\/\/www.kd2.jp\/memo3\/?p=386","title":{"rendered":"\u6587\u5b57\u5217\u9593\u306e \u300c+\u300d \u6f14\u7b97\u5b50"},"content":{"rendered":"<p>\u5148\u65e5\u3001\u9759\u7684\u306a\u6587\u5b57\u5217\u306b\u5bfe\u3059\u308bJava\u6f14\u7b97\u5b50\u306e\u632f\u308b\u821e\u3044\u306b\u3064\u3044\u3066\u6ce8\u610f\u3092\u53d7\u3051\u305f\u306e\u3067\u3001\u4eca\u66f4\u306a\u304c\u3089\u30e1\u30e2\u3092\u6b8b\u3057\u3066\u304a\u304f\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u4e0b\u8a18\u306e\u30b3\u30fc\u30c91\u3068\u30b3\u30fc\u30c92\u304c\u3069\u306e\u3088\u3046\u306b\u30b3\u30f3\u30d1\u30a4\u30eb\u3055\u308c\u308b\u304b\u3002<br \/>\n\u30b3\u30fc\u30c91 : a\u304b\u3089z\u307e\u3067\u306e\u30a2\u30eb\u30d5\u30a1\u30d9\u30c3\u30c8\u3092\u300c+\u300d\u6f14\u7b97\u3057\u3066\u7d50\u5408\u6587\u5b57\u5217\u5909\u6570\u3092\u4f5c\u6210\u3059\u308b\u3002<\/p>\n<div class=\"wp-block-codemirror-blocks code-block \">\n<pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-java&quot;,&quot;theme&quot;:&quot;eclipse&quot;,&quot;lineNumbers&quot;:true,&quot;lineWrapping&quot;:false,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}\">public class StringTest1 {\r\n  public static void main(String[] args) {\r\n    String str = \"a\" + \"b\" + \"c\" + \"d\" + \"e\" + \"f\" + \"g\" + \"h\" + \"i\" + \"j\" + \"k\" + \"l\" + \"m\" + \"n\" + \"o\" + \"p\" + \"q\" + \"r\" + \"s\" + \"t\" + \"r\" + \"u\" + \"v\" + \"w\" + \"x\" + \"y\" + \"z\";\r\n    System.out.println(str);\r\n  }\r\n}<\/pre>\n<\/div>\n<p>\u30b3\u30fc\u30c92 : a\u304b\u3089z\u307e\u3067\u306e\u30a2\u30eb\u30d5\u30a1\u30d9\u30c3\u30c8\u3092\u4e00\u3064\u306e\u6587\u5b57\u5217\u5909\u6570\u3068\u3057\u3066\u8a18\u8ff0\u3059\u308b\u3002<\/p>\n<div class=\"wp-block-codemirror-blocks code-block \">\n<pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-java&quot;,&quot;theme&quot;:&quot;eclipse&quot;,&quot;lineNumbers&quot;:true,&quot;lineWrapping&quot;:false,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}\">public class StringTest2 {\r\n  public static void main(String[] args) {\r\n    String str = \"abcdefghijklmnopqrstruvwxyz\";\r\n      System.out.println(str);\r\n  }\r\n}<\/pre>\n<\/div>\n<p>\u30b3\u30f3\u30d1\u30a4\u30eb\u5f8c\u306e\u30af\u30e9\u30b9\u306e\u30d5\u30a1\u30a4\u30eb\u30b5\u30a4\u30ba<\/p>\n<div class=\"wp-block-codemirror-blocks code-block \">\n<pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text\/x-sh&quot;,&quot;theme&quot;:&quot;eclipse&quot;,&quot;lineNumbers&quot;:false,&quot;lineWrapping&quot;:true,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}\">-rw-r--r-- 1 user group  449 Jul  7 17:42 StringTest1.class\r\n-rw-r--r-- 1 user group  449 Jul  7 17:42 StringTest2.class<\/pre>\n<\/div>\n<p>\u30b3\u30fc\u30c91\u306e\u9006\u30a2\u30bb\u30f3\u30d6\u30eb<\/p>\n<div class=\"wp-block-codemirror-blocks code-block \">\n<pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text\/x-sh&quot;,&quot;theme&quot;:&quot;eclipse&quot;,&quot;lineNumbers&quot;:false,&quot;lineWrapping&quot;:false,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}\">$ javap StringTest1.class\r\nCompiled from \"StringTest1.java\"\r\npublic class StringTest1 {\r\n  public StringTest1();\r\n  public static void main(java.lang.String[]);\r\n}<\/pre>\n<\/div>\n<p>\u30b3\u30fc\u30c92\u306e\u9006\u30a2\u30bb\u30f3\u30d6\u30eb<\/p>\n<div class=\"wp-block-codemirror-blocks code-block \">\n<pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text\/x-sh&quot;,&quot;theme&quot;:&quot;eclipse&quot;,&quot;lineNumbers&quot;:false,&quot;lineWrapping&quot;:false,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}\">$ javap StringTest2.class\r\nCompiled from \"StringTest2.java\"\r\npublic class StringTest2 {\r\n  public StringTest2();\r\n  public static void main(java.lang.String[]);\r\n}<\/pre>\n<\/div>\n<p>\u30b3\u30f3\u30d1\u30a4\u30eb\u5f8c\u306e\u30b3\u30fc\u30c91\u3068\u30b3\u30fc\u30c92\u306f\u540c\u3058\u3082\u306e\u3067\u3042\u308b\u3053\u3068\u304c\u308f\u304b\u308b\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u6b21\u306b\u3001\u300c+\u300d\u6f14\u7b97\u5b50\u3092StringBuilder\u306eappend\u30e1\u30bd\u30c3\u30c9\u306b\u5909\u66f4\u3057\u3066\u3001\u5b9f\u884c\u6642\u9593\u3092\u8a08\u6e2c\u3059\u308b\u3002<\/p>\n<p>\u30b3\u30fc\u30c91 \u6539 : \u30b3\u30fc\u30c91\u3067\u5b9f\u884c\u6642\u9593\u3092\u8a08\u6e2c\u3059\u308b\u3088\u3046\u306b\u3057\u305f\u3002<\/p>\n<div class=\"wp-block-codemirror-blocks code-block \">\n<pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-java&quot;,&quot;theme&quot;:&quot;eclipse&quot;,&quot;lineNumbers&quot;:true,&quot;lineWrapping&quot;:false,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}\">public class StringTest1 {\r\n  public static void main(String[] args) {\r\n    long startTime = System.nanoTime();\r\n    String str = \"a\" + \"b\" + \"c\" + \"d\" + \"e\" + \"f\" + \"g\" + \"h\" + \"i\" + \"j\" + \"k\" + \"l\" + \"m\" + \"n\" + \"o\" + \"p\" + \"q\" + \"r\" + \"s\" + \"t\" + \"r\" + \"u\" + \"v\" + \"w\" + \"x\" + \"y\" + \"z\";\r\n    System.out.println(str);\r\n    long endTime = System.nanoTime();\r\n    System.out.println(endTime - startTime);\r\n  }\r\n}<\/pre>\n<\/div>\n<p>\u30b3\u30fc\u30c93 : \u30b3\u30fc\u30c91\u6539\u306e\u300c+\u300d\u6f14\u7b97\u5b50\u3092StringBuilder\u306eappend\u30e1\u30bd\u30c3\u30c9\u306b\u5909\u66f4\u3057\u305f\u3002<\/p>\n<div class=\"wp-block-codemirror-blocks code-block \">\n<pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-java&quot;,&quot;theme&quot;:&quot;eclipse&quot;,&quot;lineNumbers&quot;:true,&quot;lineWrapping&quot;:false,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}\">public class StringTest3 {\r\n  public static void main(String[] args) {\r\n    long startTime = System.nanoTime();\r\n    StringBuilder build = new StringBuilder(\"a\")\r\n      .append(\"b\").append(\"c\").append(\"d\").append(\"e\").append(\"f\")\r\n      .append(\"g\").append(\"h\").append(\"i\").append(\"j\").append(\"k\")\r\n      .append(\"l\").append(\"m\").append(\"n\").append(\"o\").append(\"p\")\r\n      .append(\"q\").append(\"r\").append(\"s\").append(\"t\").append(\"u\")\r\n      .append(\"v\").append(\"w\").append(\"x\").append(\"y\").append(\"z\");\r\n    System.out.println(build);\r\n    long endTime = System.nanoTime();\r\n    System.out.println(endTime - startTime);\r\n  }\r\n}<\/pre>\n<\/div>\n<p>\u30b3\u30fc\u30c91\u5b9f\u884c:<\/p>\n<div class=\"wp-block-codemirror-blocks code-block\">\n<pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text\/x-sh&quot;,&quot;theme&quot;:&quot;eclipse&quot;,&quot;lineNumbers&quot;:false,&quot;lineWrapping&quot;:false,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}\">$ java StringTest1\r\nabcdefghijklmnopqrstruvwxyz\r\n178237<\/pre>\n<\/div>\n<p>\u30b3\u30fc\u30c93\u5b9f\u884c:<\/p>\n<div class=\"wp-block-codemirror-blocks code-block \">\n<pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text\/x-sh&quot;,&quot;theme&quot;:&quot;eclipse&quot;,&quot;lineNumbers&quot;:false,&quot;lineWrapping&quot;:false,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}\">$ java StringTest3\r\nabcdefghijklmnopqrstuvwxyz\r\n248851<\/pre>\n<\/div>\n<p>StringBuilder\u3092\u4f7f\u7528\u3059\u308b\u3068\u304b\u3048\u3063\u3066\u9045\u304f\u306a\u308b\u3053\u3068\u304c\u308f\u304b\u308b\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u5b9f\u884c\u6642\u306b\u52d5\u7684\u306b\u5909\u5316\u3057\u306a\u3044\u6587\u5b57\u5217\u5909\u6570\u306b\u95a2\u3057\u3066\u306f\u3001\u30b3\u30f3\u30d1\u30a4\u30e9\u304c\u6700\u9069\u5316\u3057\u3066\u304f\u308c\u308b\u306e\u3067\u3001\u300c+\u300d\u6f14\u7b97\u5b50\u3092\u9664\u53bb\u3057\u3066\u3082\u610f\u5473\u304c\u306a\u304f\u3001StringBuilder\u3092\u4f7f\u7528\u3059\u308b\u3068\u304b\u3048\u3063\u3066\u52b9\u7387\u304c\u60aa\u304f\u306a\u308b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5148\u65e5\u3001\u9759\u7684\u306a\u6587\u5b57\u5217\u306b\u5bfe\u3059\u308bJava\u6f14\u7b97\u5b50\u306e\u632f\u308b\u821e\u3044\u306b\u3064\u3044\u3066\u6ce8\u610f\u3092\u53d7\u3051\u305f\u306e\u3067\u3001\u4eca\u66f4\u306a\u304c\u3089\u30e1\u30e2\u3092\u6b8b\u3057\u3066\u304a\u304f\u3002 &nbsp; \u4e0b\u8a18\u306e\u30b3\u30fc\u30c91\u3068\u30b3\u30fc\u30c92\u304c\u3069\u306e\u3088\u3046\u306b\u30b3\u30f3\u30d1\u30a4\u30eb\u3055\u308c\u308b\u304b\u3002 \u30b3\u30fc\u30c91 : a\u304b\u3089z\u307e\u3067\u306e\u30a2\u30eb\u30d5\u30a1\u30d9\u30c3\u30c8&hellip; <a class=\"more-link\" href=\"https:\/\/www.kd2.jp\/memo3\/?p=386\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"screen-reader-text\">\u6587\u5b57\u5217\u9593\u306e \u300c+\u300d \u6f14\u7b97\u5b50<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[],"_links":{"self":[{"href":"https:\/\/www.kd2.jp\/memo3\/index.php?rest_route=\/wp\/v2\/posts\/386"}],"collection":[{"href":"https:\/\/www.kd2.jp\/memo3\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kd2.jp\/memo3\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kd2.jp\/memo3\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kd2.jp\/memo3\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=386"}],"version-history":[{"count":19,"href":"https:\/\/www.kd2.jp\/memo3\/index.php?rest_route=\/wp\/v2\/posts\/386\/revisions"}],"predecessor-version":[{"id":405,"href":"https:\/\/www.kd2.jp\/memo3\/index.php?rest_route=\/wp\/v2\/posts\/386\/revisions\/405"}],"wp:attachment":[{"href":"https:\/\/www.kd2.jp\/memo3\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=386"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kd2.jp\/memo3\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=386"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kd2.jp\/memo3\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=386"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}