{"id":4059,"date":"2024-04-27T08:24:40","date_gmt":"2024-04-27T00:24:40","guid":{"rendered":"https:\/\/xinchewhd.com.cn\/index.php\/%e9%9d%a2%e8%af%95\/%e5%ad%97%e8%8a%82%e9%9d%a2%e8%af%95%e9%a2%98%ef%bc%9a%e8%bf%90%e8%a1%8c%e6%97%b6%e5%b8%b8%e9%87%8f%e6%b1%a0%e4%b8%8e%e7%b1%bb%e5%b8%b8%e9%87%8f%e6%b1%a0%e6%9c%89%e4%bb%80%e4%b9%88%e5%8c%ba%e5%88%ab\/"},"modified":"2024-04-27T08:24:40","modified_gmt":"2024-04-27T00:24:40","slug":"%e5%ad%97%e8%8a%82%e9%9d%a2%e8%af%95%e9%a2%98%ef%bc%9a%e8%bf%90%e8%a1%8c%e6%97%b6%e5%b8%b8%e9%87%8f%e6%b1%a0%e4%b8%8e%e7%b1%bb%e5%b8%b8%e9%87%8f%e6%b1%a0%e6%9c%89%e4%bb%80%e4%b9%88%e5%8c%ba%e5%88%ab","status":"publish","type":"post","link":"https:\/\/xinchewhd.com.cn\/index.php\/%e9%9d%a2%e8%af%95\/%e5%ad%97%e8%8a%82%e9%9d%a2%e8%af%95%e9%a2%98%ef%bc%9a%e8%bf%90%e8%a1%8c%e6%97%b6%e5%b8%b8%e9%87%8f%e6%b1%a0%e4%b8%8e%e7%b1%bb%e5%b8%b8%e9%87%8f%e6%b1%a0%e6%9c%89%e4%bb%80%e4%b9%88%e5%8c%ba%e5%88%ab\/","title":{"rendered":"\u5b57\u8282\u9762\u8bd5\u9898\uff1a\u8fd0\u884c\u65f6\u5e38\u91cf\u6c60\u4e0e\u7c7b\u5e38\u91cf\u6c60\u6709\u4ec0\u4e48\u533a\u522b\uff1f"},"content":{"rendered":"<div class='wxsyncmain'>\n<p data-v-md-line=\"1\"><strong><span style=\"font-size: 20px;\">\u7c7b\u5e38\u91cf\u6c60\uff08Class Constant Pool\uff09<\/span><\/strong><\/p>\n<ul class=\"list-paddingleft-1\" style=\"list-style-type: disc;\">\n<li>\n<p><span style=\"font-size: 15px;\">\u5c5e\u4e8e Java \u5b57\u8282\u7801\u6587\u4ef6\uff08<\/span><code style=\"box-sizing: inherit;font-family: source-code-pro, Menlo, Monaco, Consolas, &quot;Courier New&quot;, monospace;font-size: 0.85em;padding: 0.25rem 0.5rem;color: rgb(71, 101, 130);background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;\"><span style=\"font-size: 15px;\">.class<\/span><\/code><span style=\"font-size: 15px;\">\u6587\u4ef6\uff09\u7684\u4e00\u90e8\u5206\u3002<\/span><\/p>\n<\/li>\n<li style=\"font-size: 15px;\">\n<p><span style=\"font-size: 15px;\">\u5728\u7f16\u8bd1\u671f\u95f4\u521b\u5efa\uff0c\u5305\u542b\u8be5\u7c7b\u7684\u6240\u6709\u7f16\u8bd1\u65f6\u5e38\u91cf\u3002<\/span><\/p>\n<\/li>\n<li style=\"font-size: 15px;\">\n<p><span style=\"font-size: 15px;\">\u8fd9\u4e9b\u5e38\u91cf\u5305\u62ec\u5b57\u7b26\u4e32\u5b57\u9762\u91cf\u3001\u6570\u5b57\u5b57\u9762\u91cf\u3001\u7c7b\u540d\u3001\u65b9\u6cd5\u540d\u3001\u5b57\u6bb5\u540d\u7b49\u3002<\/span><\/p>\n<\/li>\n<li style=\"font-size: 15px;\">\n<p><span style=\"font-size: 15px;\">\u7c7b\u5e38\u91cf\u6c60\u4e2d\u7684\u7b26\u53f7\u5f15\u7528\uff08\u7c7b\u540d\u3001\u65b9\u6cd5\u540d\u7b49\uff09\u9700\u8981\u5728\u7c7b\u52a0\u8f7d\u65f6\u89e3\u6790\u3002<\/span><\/p>\n<\/li>\n<\/ul>\n<p style=\"margin-top: 24px;margin-bottom: 24px;\"><strong><span style=\"font-size: 20px;\">\u8fd0\u884c\u65f6\u5e38\u91cf\u6c60\uff08Runtime Constant Pool\uff09<\/span><\/strong><\/p>\n<ul data-v-md-line=\"10\" style=\"list-style-type: disc;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<p><span style=\"font-size: 15px;\">\u7531 Java \u865a\u62df\u673a\uff08JVM\uff09\u5728\u7c7b\u52a0\u8f7d\u65f6\u521b\u5efa\u3002<\/span><\/p>\n<\/li>\n<li style=\"font-size: 15px;\">\n<p><span style=\"font-size: 15px;\">\u5c5e\u4e8e\u52a0\u8f7d\u5230 JVM \u4e2d\u7684\u7c7b\u6216\u63a5\u53e3\u7684\u5143\u6570\u636e\u3002<\/span><\/p>\n<\/li>\n<li style=\"font-size: 15px;\">\n<p><span style=\"font-size: 15px;\">\u5305\u542b\u7c7b\u5e38\u91cf\u6c60\u4e2d\u7684\u6240\u6709\u5185\u5bb9\uff0c\u4ee5\u53ca\u5728\u8fd0\u884c\u65f6\u53ef\u80fd\u6dfb\u52a0\u7684\u9644\u52a0\u5e38\u91cf\u3002<\/span><\/p>\n<\/li>\n<li style=\"font-size: 15px;\">\n<p><span style=\"font-size: 15px;\">\u9644\u52a0\u5e38\u91cf\u53ef\u80fd\u5305\u62ec\u901a\u8fc7 intern()\u65b9\u6cd5\u5185\u90e8\u5316\u7684\u5b57\u7b26\u4e32\u3001\u52a8\u6001\u751f\u6210\u7684\u7c7b\u6216\u65b9\u6cd5\u7b49\u3002<\/span><\/p>\n<\/li>\n<\/ul>\n<p data-v-md-line=\"15\"><span style=\"font-size: 15px;\">\u4e3e\u4f8b\u8bf4\u660e<\/span><\/p>\n<p data-v-md-line=\"17\"><span style=\"font-size: 15px;\">\u8003\u8651\u4ee5\u4e0b Java \u7c7b\uff1a<\/span><\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"java\"><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__keyword\">public<\/span> <span class=\"code-snippet__class\"><span class=\"code-snippet__keyword\">class<\/span> <span class=\"code-snippet__title\">MyClass<\/span> <\/span>{<\/span><\/code><code><span class=\"code-snippet_outer\">    <span class=\"code-snippet__keyword\">public<\/span> <span class=\"code-snippet__keyword\">static<\/span> <span class=\"code-snippet__keyword\">final<\/span> String MESSAGE = <span class=\"code-snippet__string\">\"Hello, World!\"<\/span>;<\/span><\/code><code><span class=\"code-snippet_outer\">}<\/span><\/code><\/pre>\n<\/section>\n<ul data-v-md-line=\"25\" style=\"list-style-type: disc;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<p><strong><span style=\"font-size: 15px;\">\u7c7b\u5e38\u91cf\u6c60<\/span><\/strong><span style=\"font-size: 15px;\">\uff1a\u5728\u7f16\u8bd1\u6b64\u7c7b\u65f6\uff0c\u7f16\u8bd1\u5668\u4f1a\u5728\u7c7b\u5e38\u91cf\u6c60\u4e2d\u521b\u5efa\u4ee5\u4e0b\u6761\u76ee\uff1a<\/span><\/p>\n<\/li>\n<ul data-v-md-line=\"26\" style=\"list-style-type: square;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<p><span style=\"font-size: 15px;\">\u4e00\u4e2a\u5b57\u7b26\u4e32\u5e38\u91cf\uff0c\u503c\u4e3a \u201cHello, World!\u201d<\/span><\/p>\n<\/li>\n<li style=\"font-size: 15px;\">\n<p><span style=\"font-size: 15px;\">\u4e00\u4e2a\u5bf9String\u7c7b\u7684\u7b26\u53f7\u5f15\u7528<\/span><\/p>\n<\/li>\n<\/ul>\n<li style=\"font-size: 15px;\">\n<p><strong><span style=\"font-size: 15px;\">\u8fd0\u884c\u65f6\u5e38\u91cf\u6c60<\/span><\/strong><span style=\"font-size: 15px;\">\uff1a\u5f53\u6b64\u7c7b\u7531 JVM \u52a0\u8f7d\u65f6\uff0cJVM \u4f1a\u521b\u5efa\u8fd0\u884c\u65f6\u5e38\u91cf\u6c60\uff1a<\/span><\/p>\n<\/li>\n<ul data-v-md-line=\"29\" style=\"list-style-type: square;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<p><span style=\"font-size: 15px;\">\u6700\u521d\uff0c\u5b83\u5305\u542b\u7c7b\u5e38\u91cf\u6c60\u4e2d\u7684\u6240\u6709\u6761\u76ee\u3002<\/span><\/p>\n<\/li>\n<li style=\"font-size: 15px;\">\n<p><span style=\"font-size: 15px;\">\u5982\u679c\u5728\u8fd0\u884c\u65f6\u6267\u884c\u4ee5\u4e0b\u4ee3\u7801\uff0c\u8fd0\u884c\u65f6\u5e38\u91cf\u6c60\u5c06\u6dfb\u52a0\u4e00\u4e2a\u65b0\u7684\u6761\u76ee\uff1a<\/span><span style=\"letter-spacing: 0.034em;\"><\/span><\/p>\n<\/li>\n<\/ul>\n<\/ul>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"javascript\"><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__built_in\">String<\/span> internedMessage = MESSAGE.intern();<\/span><\/code><\/pre>\n<\/section>\n<ul data-v-md-line=\"25\" style=\"list-style-type: disc;\" class=\"list-paddingleft-1\">\n<ul data-v-md-line=\"29\" style=\"list-style-type: square;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<p style=\"\"><span style=\"font-size: 15px;\">intern()\u65b9\u6cd5\u5c06\u5b57\u7b26\u4e32\u7684\u526f\u672c\u66ff\u6362\u4e3a\u5e38\u91cf\u6c60\u4e2d\u7684\u5f15\u7528\uff0c\u4ee5\u8282\u7701\u5185\u5b58\u3002<\/span><\/p>\n<\/li>\n<\/ul>\n<\/ul>\n<p style=\"margin-top: 24px;margin-bottom: 24px;\"><span style=\"font-size: 17px;\"><strong>\u4e3b\u8981\u533a\u522b<\/strong><\/span><span style=\"font-size: 15px;\"><\/span><\/p>\n<ul data-v-md-line=\"38\" style=\"list-style-type: disc;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<p><span style=\"font-size: 15px;\"><\/span><strong><span style=\"font-size: 15px;\">\u521b\u5efa\u65f6\u673a<\/span><\/strong><span style=\"font-size: 15px;\">\uff1a\u7c7b\u5e38\u91cf\u6c60\u5728\u7f16\u8bd1\u65f6\u521b\u5efa\uff0c\u800c\u8fd0\u884c\u65f6\u5e38\u91cf\u6c60\u5728\u7c7b\u52a0\u8f7d\u65f6\u521b\u5efa\u3002<\/span><\/p>\n<\/li>\n<li style=\"font-size: 15px;\">\n<p><strong><span style=\"font-size: 15px;\">\u6240\u5c5e\u8303\u56f4<\/span><\/strong><span style=\"font-size: 15px;\">\uff1a\u7c7b\u5e38\u91cf\u6c60\u5c5e\u4e8e .class \u6587\u4ef6\uff0c\u800c\u8fd0\u884c\u65f6\u5e38\u91cf\u6c60\u5c5e\u4e8e\u52a0\u8f7d\u5230 JVM \u4e2d\u7684\u7c7b\u6216\u63a5\u53e3\u3002<\/span><\/p>\n<\/li>\n<li style=\"font-size: 15px;\">\n<p><strong><span style=\"font-size: 15px;\">\u52a8\u6001\u6027<\/span><\/strong><span style=\"font-size: 15px;\">\uff1a\u7c7b\u5e38\u91cf\u6c60\u662f\u9759\u6001\u7684\uff0c\u800c\u8fd0\u884c\u65f6\u5e38\u91cf\u6c60\u53ef\u4ee5\u5728\u8fd0\u884c\u65f6\u8fdb\u884c\u4fee\u6539\uff08\u4f8b\u5982\uff0c\u901a\u8fc7 intern()\uff09\u3002<\/span><\/p>\n<\/li>\n<li style=\"font-size: 15px;\">\n<p><strong><span style=\"font-size: 15px;\">\u5185\u5bb9<\/span><\/strong><span style=\"font-size: 15px;\">\uff1a\u8fd0\u884c\u65f6\u5e38\u91cf\u6c60\u5305\u542b\u7c7b\u5e38\u91cf\u6c60\u4e2d\u7684\u6240\u6709\u5185\u5bb9\uff0c\u4ee5\u53ca\u5728\u8fd0\u884c\u65f6\u53ef\u80fd\u6dfb\u52a0\u7684\u9644\u52a0\u5e38\u91cf\u3002<\/span><\/p>\n<\/li>\n<\/ul>\n<p style=\"display: none;\"><mp-style-type data-value=\"3\"><\/mp-style-type><\/p>\n<blockquote>\n<p>\u672c\u7bc7\u6587\u7ae0\u6765\u6e90\u4e8e\u5fae\u4fe1\u516c\u4f17\u53f7:                 \u4e92\u8054\u7f51\u9762\u8bd5\u5c0f\u5e2e\u624b              <\/p>\n<\/blockquote>\n<\/div>\n","raw":"","protected":false},"excerpt":{"rendered":"<p>\u7c7b\u5e38\u91cf\u6c60\uff08Class Constant Pool\uff09 \u5c5e\u4e8e Java \u5b57\u8282\u7801\u6587\u4ef6\uff08.class\u6587\u4ef6\uff09\u7684\u4e00\u90e8\u5206\u3002 \u5728\u7f16\u8bd1\u671f\u95f4\u521b\u5efa\uff0c\u5305\u542b &#8230;<\/p>\n","protected":false},"author":1,"featured_media":4056,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"emotion":"","emotion_color":"","title_style":"","license":"","footnotes":""},"categories":[30],"tags":[],"class_list":["post-4059","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-30"],"post_thumbnail_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524144833262-150x150.jpeg","content_first_image":null,"post_medium_image_300":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524144833262-300x300.jpeg","post_thumbnail_image_624":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524144833262.jpeg","post_frist_image":null,"post_medium_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524144833262-300x300.jpeg","post_large_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524144833262.jpeg","post_full_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524144833262.jpeg","post_all_images":[],"videoAdId":"","listAd":"0","listAdId":"","listAdEvery":6,"total_comments":0,"category_name":"\u9762\u8bd5","post_date":"2024-04-27","like_count":"0","praiseWord":"\u9f13\u52b1","copyright_state":"","excitationAd":"0","rewardedVideoAdId":"","detailAdId":"","detailAd":"0","enterpriseMinapp":"0","audios":[],"postImageUrl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230519082947553.jpg","avatarurls":[],"related_posts":null,"pageviews":331,"next_post_id":4051,"next_post_title":"\u817e\u8baf\u4e00\u9762\uff1a\u4e3a\u4ec0\u4e48volatile\u4e0d\u80fd\u4fdd\u8bc1\u590d\u5408\u64cd\u4f5c\uff08\u5982\u81ea\u589e\u64cd\u4f5c i++\uff09\u7684\u7ebf\u7a0b\u5b89\u5168\uff1f","previous_post_id":4067,"previous_post_title":"\u817e\u8baf\u9762\u8bd5\u9898\uff1aJava\u4e2d\u4ec0\u4e48\u60c5\u51b5\u4e0b\u4f1a\u89e6\u53d1Minor GC\u548cFull GC\uff1f","_links":{"self":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/4059","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/comments?post=4059"}],"version-history":[{"count":0,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/4059\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/media\/4056"}],"wp:attachment":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/media?parent=4059"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/categories?post=4059"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/tags?post=4059"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}