{"id":33,"date":"2021-03-13T12:03:55","date_gmt":"2021-03-13T04:03:55","guid":{"rendered":"http:\/\/daishen.ltd\/?p=33"},"modified":"2021-03-13T12:03:55","modified_gmt":"2021-03-13T04:03:55","slug":"static%e5%85%b3%e9%94%ae%e5%ad%97","status":"publish","type":"post","link":"https:\/\/daishen.ltd\/?p=33","title":{"rendered":"static\u5173\u952e\u5b57"},"content":{"rendered":"<p><meta charset=\"UTF-8\"><meta name=\"viewport\" content=\"width=device-width initial-scale=1\"><br \/>\n<title>static\u5173\u952e\u5b57<\/title><\/p>\n<h2>\u4ec0\u4e48\u65f6\u5019\u6210\u5458\u53d8\u91cf\u58f0\u660e\u4e3a\u5b9e\u4f8b\u53d8\u91cf\u5462?<\/h2>\n<p>\u6240\u6709\u5bf9\u8c61\u90fd\u6709\u8fd9\u4e2a\u5c5e\u6027\uff0c\u4f46\u662f\u8fd9\u4e2a\u5c5e\u6027\u7684\u503c\u4f1a\u968f\u7740\u5bf9\u8c61\u7684\u53d8\u5316\u800c\u53d8\u5316[\u4e0d\u540c\u5bf9\u8c61\u7684\u8fd9\u4e2a\u5c5e\u6027\u5177\u4f53\u7684\u503c\u4e0d\u540c]<br \/>\n\u4ec0\u4e48\u65f6\u5019\u6210\u5458\u53d8\u91cf\u58f0\u660e\u4e3a\u9759\u6001\u53d8\u91cf\u5462?<br \/>\n\u6240\u6709\u5bf9\u8c61\u90fd\u6709\u8fd9\u4e2a\u5c5e\u6027\uff0c\u5e76\u4e14\u6240\u6709\u5bf9\u8c61\u7684\u8fd9\u4e2a\u5c5e\u6027\u7684\u503c\u662f\u4e00\u6837\u7684, \u5efa\u8bae\u5b9a\u4e49\u4e3a\u9759\u6001\u53d8\u91cf\uff0c\u8282\u7701\u5185\u5b58\u7684\u5f00\u9500\u3002<br \/>\n\u9759\u6001\u53d8\u91cf\u5728\u7c7b\u52a0\u8f7d\u7684\u65f6\u5019\u521d\u59cb\u5316\uff0c\u5185\u5b58\u5728\u65b9\u6cd5\u533a\u4e2d\u5f00\u8f9f\u3002\u8bbf\u95ee\u7684\u65f6\u5019\u4e0d\u9700\u8981\u521b\u5efa\u5bf9\u8c61\uff0c\u76f4\u63a5\u4f7f\u7528\u201c\u7c7b\u540d.\u9759\u6001\u53d8\u91cf\u540d\u201d\u7684\u65b9\u5f0f\u8bbf\u95ee\u3002<\/p>\n<h2>\u5173\u4e8ejava\u4e2d\u7684static\u5173\u952e\u5b57:<\/h2>\n<p>1\u3001static\u82f1\u8bed\u5355\u8bcd\u7ffb\u8bd1\u4e3a\u9759\u6001\u7684<br \/>\n2\u3001static\u4fee\u9970\u7684\u65b9\u6cd5\u662f\u9759\u6001\u65b9\u6cd5<br \/>\n3\u3001static\u4fee\u9970\u7684\u53d8\u91cf\u662f\u9759\u6001\u53d8\u91cf<br \/>\n4\u3001\u6240\u6709static\u4fee\u9970\u7684\u5143\u7d20\u90fd\u79f0\u4e3a\u9759\u6001\u7684\uff0c\u90fd\u53ef\u4ee5\u4f7f\u7528\u201c\u7c7b\u540d\u3002\u201d\u7684\u65b9\u5f0f\u8bbf\u95ee\uff0c\u5f53\u7136\u4e5f\u53ef\u4ee5\u7528\u5f15\u7528.\u7684\u65b9\u5f0f\u8bbf\u95ee[\u4f46\u4e0d\u5efa\u8bae]<\/p>\n<p>5\u3001static\u4fee\u9970\u7684\u6240\u6709\u5143\u7d20\u90fd\u662f\u7c7b\u7ea7\u522b\u7684\u7279\u5f81\uff0c\u548c\u5177\u4f53\u7684\u5bf9\u8c61\u65e0\u5173<\/p>\n<h2>\u9759\u6001\u4ee3\u7801\u5757<\/h2>\n<h4>1\u3001\u8bed\u6cd5\u683c\u5f0f:<\/h4>\n<pre><code class=\"language-java\" lang=\"java\">static{\njava\u8bed\u53e5;\n}\n<\/code><\/pre>\n<h4>2\u3001\u9759\u6001\u4ee3\u7801\u5757\u5728\u7c7b\u52a0\u8f7d\u65f6\u6267\u884c,\u5e76\u4e14\u53ea\u6267\u884c1\u6b21\u3002<\/h4>\n<h4>3\u3001\u9759\u6001\u4ee3\u7801\u5757\u5728\u4e00\u4e2a\u7c7b\u4e2d\u53ef\u4ee5\u7f16\u5199\u591a\u4e2a\uff0c\u5e76\u4e14\u9075\u5faa\u81ea\u4e0a\u800c\u4e0b\u7684\u987a\u5e8f\u4f9d\u6b21\u6267\u884c\u3002<\/h4>\n<h4>4\u3001\u9759\u6001\u4ee3\u7801\u5757\u7684\u4f5c\u7528\u4ec0\u4e48?\u600e\u4e48\u7528?\u7528\u5728\u54ea\u513f?\u4ec0\u4e48\u65f6\u5019\u7528?<\/h4>\n<p>-\u8fd9\u5f53\u7136\u548c\u5177\u4f53\u7684\u9700\u6c42\u6709\u5173\uff0c\u4f8b\u5982\u9879\u76ee\u4e2d\u8981\u6c42\u5728\u7c7b\u52a0\u8f7d\u7684\u65f6\u523b\/\u65f6\u673a\u6267\u884c\u4ee3\u7801\u5b8c\u6210\u65e5\u5fd7\u7684\u8bb0\u5f55\u3002<br \/>\n\u90a3\u4e48\u8fd9\u6bb5\u8bb0\u5f55\u65e5\u5fd7\u7684\u4ee3\u7801\u5c31\u53ef\u4ee5\u7f16\u5199\u5230\u9759\u6001\u4ee3\u7801\u5757\u5f53\u4e2d,\u5b8c\u6210\u65e5\u5fd7\u8bb0\u5f55\u3002<br \/>\n\u200b\t-\u9759\u6001\u4ee3\u7801\u5757\u662fjava\u4e3a\u7a0b \u5e8f\u5458\u51c6\u5907\u4e00\u4e2a\u7279\u6b8a\u7684\u65f6\u523b\uff0c \u8fd9\u4e2a\u7279\u6b8a\u7684\u65f6\u523b\u88ab\u79f0\u4e3a\u7c7b\u52a0\u8f7d\u65f6\u523b\u3002\u82e5<br \/>\n\u5e0c\u671b\u5728\u6b64\u523b\u6267\u884c\u4e00\u6bb5\u7279\u6b8a\u7684\u7a0b\u5e8f\uff0c\u8fd9\u6bb5\u7a0b\u5e8f\u53ef\u4ee5\u76f4\u63a5\u653e\u5230\u9759\u6001\u4ee3\u7801\u5757\u5f53\u4e2d\u3002<\/p>\n<h4>5\u3001\u901a\u5e38\u5728\u9759\u6001\u4ee3\u7801\u5757\u5f53\u4e2d\u5b8c\u6210\u9884\u5907\u5de5\u4f5c,\u5148\u5b8c\u6210\u6570\u636e\u7684\u51c6\u5907\u5de5\u5177,\u4f8b\u5982:\u521d\u59cb\u5316\u8fde\u63a5\u6c60\uff0c\u89e3\u6790XMI\u914d\u7f6e\u6587\u4ef6<\/h4>\n<p>&nbsp;<\/p>\n<h2>\u5b9e\u4f8b\u8bed\u53e5\u5757\/\u4ee3\u7801\u5757[\u4e86\u89e3\u5185\u5bb9\uff0c\u4f7f\u7528\u7684\u975e\u5e38\u5c11]<\/h2>\n<p>1\u3001\u5b9e\u4f8b\u4ee3\u7801\u5757\u53ef\u4ee5\u7f16\u5199\u591a\u4e2a\uff0c\u4e5f\u662f\u9075\u5faa\u81ea\u4e0a\u800c\u4e0b\u7684\u987a\u5e8f\u4f9d\u6b21\u6267\u884c<br \/>\n2\u3001\u5b9e\u4f8b\u4ee3\u7801\u5757\u5728\u6784\u9020\u65b9\u6cd5\u6267\u884c\u4e4b\u524d\u6267\u884c\uff0c\u6784\u9020\u65b9\u6cd5\u6267\u884c\u4f9d\u6b21\uff0c\u5b9e\u4f8b\u4ee3\u7801\u5757\u5bf9\u5e94\u6267\u884c1\u6b21\u3002<br \/>\n3\u3001\u5b9e\u4f8b\u4ee3\u7801\u5757\u4e5f\u662fjava\u8bed\u8a00\u4e3a\u7a0b\u5e8f\u5458\u51c6\u5907\u4e00\u4e2a \u7279\u6b8a\u7684\u65f6\u673a\uff0c\u8fd9\u4e2a\u7279\u6b8a\u65f6\u673a\u88ab\u79f0\u4e3a:\u5bf9\u8c61\u521d\u59cb\u5316\u65f6\u673a\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>public\u8868\u793a\u516c\u5f00\u7684\uff0c\u5728\u4efb\u4f55\u4f4d\u7f6e\u90fd\u662f\u53ef\u4ee5\u8bbf\u95ee\u7684<br \/>\nstatic\u8868\u793a\u9759\u6001\u7684\uff0c\u4f7f\u7528\u7c7b\u540d. &#8220;\u7684\u65b9\u5f0f\u5373\u53ef\u8bbf\u95ee\uff0c\u4e0d\u9700\u8981\u521b\u5efa\u5bf9\u8c61,\u5c31\u53ef\u4ee5\u8c03\u7528main\u65b9\u6cd5<br \/>\nvoid\u8868\u793ama in\u65b9\u6cd5\u6267\u884c\u7ed3\u675f\u4e4b\u540e\u4e0d\u8fd4\u56de\u4efb\u4f55\u503c<br \/>\nmain\u662fmain\u65b9\u6cd5\u7684\u65b9\u6cd5\u540d<br \/>\n(String[] args) \u662fmain\u65b9\u6cd5\u7684\u5f62\u5f0f\u53c2\u6570\u5217\u8868<\/p>\n","protected":false},"excerpt":{"rendered":"<p>static\u5173\u952e\u5b57 \u4ec0\u4e48\u65f6\u5019\u6210\u5458\u53d8\u91cf\u58f0\u660e\u4e3a\u5b9e\u4f8b\u53d8\u91cf\u5462? \u6240\u6709\u5bf9\u8c61\u90fd\u6709\u8fd9\u4e2a\u5c5e\u6027\uff0c\u4f46\u662f\u8fd9\u4e2a\u5c5e\u6027\u7684\u503c\u4f1a\u968f\u7740\u5bf9\u8c61\u7684\u53d8\u5316 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-33","post","type-post","status-publish","format-standard","hentry","category-java"],"_links":{"self":[{"href":"https:\/\/daishen.ltd\/index.php?rest_route=\/wp\/v2\/posts\/33","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/daishen.ltd\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/daishen.ltd\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/daishen.ltd\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/daishen.ltd\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=33"}],"version-history":[{"count":1,"href":"https:\/\/daishen.ltd\/index.php?rest_route=\/wp\/v2\/posts\/33\/revisions"}],"predecessor-version":[{"id":34,"href":"https:\/\/daishen.ltd\/index.php?rest_route=\/wp\/v2\/posts\/33\/revisions\/34"}],"wp:attachment":[{"href":"https:\/\/daishen.ltd\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=33"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/daishen.ltd\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=33"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/daishen.ltd\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=33"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}