{"id":64900,"date":"2025-05-03T09:14:56","date_gmt":"2025-05-03T01:14:56","guid":{"rendered":"https:\/\/fwq.ai\/blog\/64900\/"},"modified":"2025-05-03T09:14:56","modified_gmt":"2025-05-03T01:14:56","slug":"java-%e5%af%bc%e5%85%a5%e4%b8%ad%e7%9a%84-static%ef%bc%9a%e5%ae%83%e5%88%b0%e5%ba%95%e6%84%8f%e5%91%b3%e7%9d%80%e4%bb%80%e4%b9%88%ef%bc%9f-3","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/64900\/","title":{"rendered":"Java \u5bfc\u5165\u4e2d\u7684 static\uff1a\u5b83\u5230\u5e95\u610f\u5473\u7740\u4ec0\u4e48\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173088255677132.jpg\" class=\"aligncenter\" title=\"Java \u5bfc\u5165\u4e2d\u7684 static\uff1a\u5b83\u5230\u5e95\u610f\u5473\u7740\u4ec0\u4e48\uff1f\u63d2\u56fe\" alt=\"Java \u5bfc\u5165\u4e2d\u7684 static\uff1a\u5b83\u5230\u5e95\u610f\u5473\u7740\u4ec0\u4e48\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>java \u5bfc\u5165\u65f6\u51fa\u73b0\u7684 static\uff0c\u63ed\u79d8\u5176\u542b\u4e49<\/strong><\/p>\n<p>\u5728\u5bfc\u5165 java \u7c7b\u65f6\uff0c\u60a8\u53ef\u80fd\u4f1a\u770b\u5230 static \u4e00\u8bcd\u3002\u90a3\u4e48\uff0c\u5b83\u7684\u542b\u4e49\u662f\u4ec0\u4e48\u5462\uff1f<\/p>\n<p><strong>\u9759\u6001\u5bfc\u5165<\/strong><\/p>\n<p>static \u662f java 5 \u4e2d\u5f15\u5165\u7684\u4e00\u9879\u529f\u80fd\uff0c\u53ef\u7528\u4e8e\u5bfc\u5165\u9759\u6001\u6210\u5458\uff08\u9759\u6001\u65b9\u6cd5\u548c\u5e38\u91cf\uff09\u3002\u8fd9\u4e00\u529f\u80fd\u6709\u5229\u4e8e\u51cf\u5c11\u952e\u5165\u6b21\u6570\uff0c\u5c24\u5176\u662f\u5728\u60a8\u9700\u8981\u7ecf\u5e38\u4f7f\u7528\u9759\u6001\u6210\u5458\u65f6\u3002<\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<p><strong>\u4f7f\u7528\u65b9\u6cd5<\/strong><\/p>\n<p>\u8981 \u8fdb\u884c\u9759\u6001\u5bfc\u5165\uff0c\u8bf7\u4f7f\u7528\u4ee5\u4e0b\u8bed\u6cd5\uff1a<\/p>\n<pre>import static &lt;\u5168\u9650\u5b9a\u7c7b\u540d&gt;.&lt;\u9759\u6001\u6210\u5458\u540d&gt;;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4f8b\u5982\uff1a<\/p>\n<pre>import static java.lang.System.out;\nimport static java.lang.Integer.*;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8fd9\u5c06\u5141\u8bb8\u60a8\u76f4\u63a5\u8bbf\u95ee system.out \u548c integer \u7c7b\u7684\u6240\u6709\u9759\u6001\u6210\u5458\uff0c\u800c\u4e0d\u9700\u8981\u6307\u5b9a\u7c7b\u540d\u3002<\/p>\n<p><strong>\u4f18\u70b9\u548c\u539f\u5219<\/strong><\/p>\n<p>\u9759\u6001\u5bfc\u5165\u7684\u4f18\u70b9\u5305\u62ec\u66f4\u7b80\u6d01\u7684\u4ee3\u7801\u548c\u51cf\u5c11\u952e\u5165\u6b21\u6570\u3002\u7136\u800c\uff0c\u4e5f\u6709\u4e00\u4e9b\u539f\u5219\u9700\u8981\u9075\u5faa\uff1a<\/p>\n<ul>\n<li><strong>\u5fc5\u987b\u4f7f\u7528 import static \u5173\u952e\u5b57\u3002<\/strong><\/li>\n<li><strong>\u907f\u514d\u540d\u79f0\u6a21\u7cca\u7684\u9759\u6001\u6210\u5458\u3002<\/strong><\/li>\n<li><strong>\u53ea\u80fd\u5bfc\u5165\u9759\u6001\u5bf9\u8c61\u5f15\u7528\u3001\u5e38\u91cf\u548c\u9759\u6001\u65b9\u6cd5\u3002<\/strong><\/li>\n<\/ul>\n<p><strong>\u6ce8\u610f\u4e8b\u9879<\/strong><\/p>\n<p>\u9759\u6001\u5bfc\u5165\u867d\u7136\u65b9\u4fbf\uff0c\u4f46\u4e5f\u53ef\u80fd\u4f1a\u4f7f\u4ee3\u7801\u96be\u4ee5\u9605\u8bfb\u3002\u56e0\u6b64\uff0c\u5efa\u8bae\u8c28\u614e\u4f7f\u7528\uff0c\u7279\u522b\u662f\u5728\u5927\u578b\u6216\u590d\u6742\u7684\u9879\u76ee\u4e2d\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fJava \u5bfc\u5165\u4e2d\u7684 static\uff1a\u5b83\u5230\u5e95\u610f\u5473\u7740\u4ec0\u4e48\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8IDCBABY\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>java \u5bfc\u5165\u65f6\u51fa\u73b0\u7684 static\uff0c\u63ed\u79d8\u5176\u542b\u4e49 \u5728\u5bfc\u5165 java \u7c7b\u65f6\uff0c\u60a8\u53ef\u80fd\u4f1a\u770b\u5230 static \u4e00\u8bcd\u3002\u90a3\u4e48\uff0c\u5b83\u7684\u542b\u4e49\u662f\u4ec0\u4e48\u5462\uff1f \u9759\u6001\u5bfc\u5165 static \u662f java 5 \u4e2d\u5f15\u5165\u7684\u4e00\u9879\u529f\u80fd\uff0c\u53ef\u7528\u4e8e\u5bfc\u5165\u9759\u6001\u6210\u5458\uff08\u9759\u6001\u65b9\u6cd5\u548c\u5e38\u91cf\uff09\u3002\u8fd9\u4e00\u529f\u80fd\u6709\u5229\u4e8e\u51cf\u5c11\u952e\u5165\u6b21\u6570\uff0c\u5c24\u5176\u662f\u5728\u60a8\u9700\u8981\u7ecf\u5e38\u4f7f\u7528\u9759\u6001\u6210\u5458\u65f6\u3002 \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b \u4f7f\u7528\u65b9\u6cd5 \u8981 \u8fdb\u884c\u9759\u6001\u5bfc\u5165\uff0c\u8bf7\u4f7f\u7528\u4ee5\u4e0b\u8bed\u6cd5\uff1a import static &lt;\u5168\u9650\u5b9a\u7c7b\u540d&gt;.&lt;\u9759\u6001\u6210\u5458\u540d&gt;; \u767b\u5f55\u540e\u590d\u5236 \u4f8b\u5982\uff1a import static java.lang.System.out; import static java.lang.Integer.*; \u767b\u5f55\u540e\u590d\u5236 \u8fd9\u5c06\u5141\u8bb8\u60a8\u76f4\u63a5\u8bbf\u95ee system.out \u548c integer \u7c7b\u7684\u6240\u6709\u9759\u6001\u6210\u5458\uff0c\u800c\u4e0d\u9700\u8981\u6307\u5b9a\u7c7b\u540d\u3002 \u4f18\u70b9\u548c\u539f\u5219 \u9759\u6001\u5bfc\u5165\u7684\u4f18\u70b9\u5305\u62ec\u66f4\u7b80\u6d01\u7684\u4ee3\u7801\u548c\u51cf\u5c11\u952e\u5165\u6b21\u6570\u3002\u7136\u800c\uff0c\u4e5f\u6709\u4e00\u4e9b\u539f\u5219\u9700\u8981\u9075\u5faa\uff1a \u5fc5\u987b\u4f7f\u7528 import static \u5173\u952e\u5b57\u3002 \u907f\u514d\u540d\u79f0\u6a21\u7cca\u7684\u9759\u6001\u6210\u5458\u3002 \u53ea\u80fd\u5bfc\u5165\u9759\u6001\u5bf9\u8c61\u5f15\u7528\u3001\u5e38\u91cf\u548c\u9759\u6001\u65b9\u6cd5\u3002 \u6ce8\u610f\u4e8b\u9879 \u9759\u6001\u5bfc\u5165\u867d\u7136\u65b9\u4fbf\uff0c\u4f46\u4e5f\u53ef\u80fd\u4f1a\u4f7f\u4ee3\u7801\u96be\u4ee5\u9605\u8bfb\u3002\u56e0\u6b64\uff0c\u5efa\u8bae\u8c28\u614e\u4f7f\u7528\uff0c\u7279\u522b\u662f\u5728\u5927\u578b\u6216\u590d\u6742\u7684\u9879\u76ee\u4e2d\u3002 \u4ee5\u4e0a\u5c31\u662fJava \u5bfc\u5165\u4e2d\u7684 static\uff1a\u5b83\u5230\u5e95\u610f\u5473\u7740\u4ec0\u4e48\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8IDCBABY\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-64900","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/64900","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=64900"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/64900\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=64900"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=64900"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=64900"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}