{"id":60020,"date":"2026-01-14T20:57:23","date_gmt":"2026-01-14T12:57:23","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/60020.html"},"modified":"2026-01-14T20:57:23","modified_gmt":"2026-01-14T12:57:23","slug":"java%e5%9f%ba%e7%a1%80-%e9%9d%a2%e5%90%91%e5%af%b9%e8%b1%a1%ef%bc%88%e5%9b%9b%ef%bc%89","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/60020.html","title":{"rendered":"Java\u57fa\u7840\u2014\u2014\u9762\u5411\u5bf9\u8c61\uff08\u56db\uff09"},"content":{"rendered":"<p>\u63d0\u793a&#xff1a;\u672c\u6587\u8bb2\u8ff0\u9759\u6001\u3001\u679a\u4e3e\u3001\u5305\u88c5\u7c7b\u3001\u62bd\u8c61\u7c7b\u3001\u5185\u90e8\u7c7b<\/p>\n<h4>7.1 \u9759\u6001<\/h4>\n<h5>7.1.1 \u9759\u6001\u5173\u952e\u5b57&#xff08;static&#xff09;<\/h5>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u9759\u6001\u5173\u952e\u5b57\u7528\u4e8e\u4fee\u9970\u4e0e\u7c7b\u800c\u975e\u5bf9\u8c61\u5173\u8054\u7684\u6210\u5458\u53d8\u91cf\u548c\u65b9\u6cd5\u3002\u5f53\u6210\u5458\u53d8\u91cf\u6216\u65b9\u6cd5\u4e0e\u7c7b\u7684\u5b9e\u4f8b\u65e0\u5173\u65f6&#xff0c;\u4f7f\u7528static\u53ef\u4ee5\u907f\u514d\u4e3a\u6bcf\u4e2a\u5bf9\u8c61\u5355\u72ec\u5b58\u50a8\u6216\u8c03\u7528&#xff0c;\u63d0\u5347\u6548\u7387\u548c\u4ee3\u7801\u7b80\u6d01\u6027\u3002<\/p>\n<h5>7.1.2 \u9759\u6001\u53d8\u91cf<\/h5>\n<ul>\n<li>\n<p>\u8bed\u6cd5\u683c\u5f0f<\/p>\n<p>\u3010\u4fee\u9970\u7b26\u3011 class \u7c7b\u540d {<br \/>\n    \u3010\u5176\u4ed6\u4fee\u9970\u7b26\u3011 static \u6570\u636e\u7c7b\u578b \u53d8\u91cf\u540d;<br \/>\n}\n<\/li>\n<li>\n<p>\u7279\u70b9<\/p>\n<ul>\n<li>\u9ed8\u8ba4\u503c\u4e0e\u5b9e\u4f8b\u53d8\u91cf\u76f8\u540c&#xff08;\u57fa\u672c\u7c7b\u578b\u4e3a0\/false&#xff0c;\u5f15\u7528\u7c7b\u578b\u4e3anull&#xff09;\u3002<\/li>\n<li>\u6240\u6709\u5bf9\u8c61\u5171\u4eab\u540c\u4e00\u4efd\u6570\u636e&#xff0c;\u5b58\u50a8\u5728\u65b9\u6cd5\u533a\u3002<\/li>\n<li>\u672c\u7c7b\u4e2d\u53ef\u76f4\u63a5\u4f7f\u7528&#xff1b;\u5176\u4ed6\u7c7b\u4e2d\u901a\u8fc7\u7c7b\u540d.\u53d8\u91cf\u540d\u8bbf\u95ee&#xff08;\u63a8\u8350&#xff09;\u6216\u5bf9\u8c61.\u53d8\u91cf\u540d\u8bbf\u95ee\u3002<\/li>\n<li>\u9759\u6001\u53d8\u91cf\u7684get\/set\u65b9\u6cd5\u9700\u4e3a\u9759\u6001\u65b9\u6cd5&#xff0c;\u91cd\u540d\u65f6\u7528\u7c7b\u540d.\u53d8\u91cf\u540d\u533a\u5206\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u5185\u5b58\u5206\u6790<br \/>\n\u9759\u6001\u53d8\u91cf\u5728\u7c7b\u52a0\u8f7d\u65f6\u5206\u914d\u5185\u5b58&#xff0c;\u751f\u547d\u5468\u671f\u4e0e\u7c7b\u76f8\u540c&#xff0c;\u72ec\u7acb\u4e8e\u5bf9\u8c61\u5b9e\u4f8b\u3002<\/p>\n<\/li>\n<li>\n<p>\u4e0e\u5176\u4ed6\u53d8\u91cf\u5bf9\u6bd4<\/p>\n<ul>\n<li>\u9759\u6001\u53d8\u91cf&#xff1a;\u65b9\u6cd5\u533a\u5b58\u50a8&#xff0c;\u7c7b\u5171\u4eab&#xff0c;\u6709\u9ed8\u8ba4\u503c\u3002<\/li>\n<li>\u5b9e\u4f8b\u53d8\u91cf&#xff1a;\u5806\u5b58\u50a8&#xff0c;\u5bf9\u8c61\u72ec\u7acb&#xff0c;\u6709\u9ed8\u8ba4\u503c\u3002<\/li>\n<li>\u5c40\u90e8\u53d8\u91cf&#xff1a;\u6808\u5b58\u50a8&#xff0c;\u65e0\u9ed8\u8ba4\u503c&#xff0c;\u4f5c\u7528\u57df\u9650\u4e8e\u65b9\u6cd5\/\u5757\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h5>7.1.3 \u9759\u6001\u65b9\u6cd5<\/h5>\n<ul>\n<li>\u8bed\u6cd5\u683c\u5f0f\n<p>\u3010\u4fee\u9970\u7b26\u3011 static \u8fd4\u56de\u503c\u7c7b\u578b \u65b9\u6cd5\u540d(\u53c2\u6570\u5217\u8868) {<br \/>\n    \u65b9\u6cd5\u4f53<br \/>\n}\n<\/li>\n<li>\u7279\u70b9\n<ul>\n<li>\u53ef\u76f4\u63a5\u901a\u8fc7\u7c7b\u540d.\u65b9\u6cd5\u540d()\u8c03\u7528&#xff0c;\u65e0\u9700\u5b9e\u4f8b\u5316\u3002<\/li>\n<li>\u53ef\u7ee7\u627f\u4f46\u4e0d\u53ef\u91cd\u5199&#xff08;\u5b50\u7c7b\u540c\u540d\u65b9\u6cd5\u4e3a\u9690\u85cf\u800c\u975e\u8986\u76d6&#xff09;\u3002<\/li>\n<li>\u8c03\u7528\u65f6\u57fa\u4e8e\u7f16\u8bd1\u65f6\u7c7b\u578b&#xff08;\u591a\u6001\u4e0d\u9002\u7528&#xff09;\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h5>7.1.4 \u9759\u6001\u4ee3\u7801\u5757<\/h5>\n<ul>\n<li>\u8bed\u6cd5\u683c\u5f0f\n<p>static {<br \/>\n    \/\/ \u521d\u59cb\u5316\u4ee3\u7801<br \/>\n}\n<\/li>\n<li>\u7279\u70b9\n<ul>\n<li>\u7528\u4e8e\u9759\u6001\u53d8\u91cf\u521d\u59cb\u5316&#xff0c;\u7c7b\u52a0\u8f7d\u65f6\u6267\u884c\u4e00\u6b21\u3002<\/li>\n<li>\u6267\u884c\u4f18\u5148\u7ea7\u9ad8\u4e8e\u975e\u9759\u6001\u4ee3\u7801\u5757\u548c\u6784\u9020\u5668\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u9759\u6001\u4e0e\u975e\u9759\u6001\u7684\u533a\u522b<\/p>\n<h5>1\u3001\u672c\u7c7b\u4e2d\u7684\u8bbf\u95ee\u9650\u5236\u533a\u522b<\/h5>\n<ul>\n<li>\n<p>\u9759\u6001\u76f4\u63a5\u8bbf\u95ee\u9759\u6001&#xff0c;\u53ef\u4ee5<\/p>\n<\/li>\n<li>\n<p>\u975e\u9759\u6001\u76f4\u63a5\u8bbf\u95ee\u975e\u9759\u6001&#xff0c;\u53ef\u4ee5<\/p>\n<\/li>\n<li>\n<p>\u975e\u9759\u6001\u76f4\u63a5\u8bbf\u95ee\u9759\u6001&#xff0c;\u53ef\u4ee5<\/p>\n<\/li>\n<li>\n<p>\u9759\u6001\u76f4\u63a5\u8bbf\u95ee\u975e\u9759\u6001&#xff0c;\u4e0d\u53ef\u4ee5<\/p>\n<\/li>\n<\/ul>\n<h5>2\u3001\u5728\u5176\u4ed6\u7c7b\u7684\u8bbf\u95ee\u65b9\u5f0f\u533a\u522b<\/h5>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u9759\u6001\u7684\u7c7b\u53d8\u91cf\u548c\u9759\u6001\u7684\u65b9\u6cd5\u53ef\u4ee5\u901a\u8fc7\u201c\u7c7b\u540d.\u201d\u7684\u65b9\u5f0f\u76f4\u63a5\u8bbf\u95ee&#xff1b;\u4e5f\u53ef\u4ee5\u901a\u8fc7\u201c\u5bf9\u8c61.&#034;\u7684\u65b9\u5f0f\u8bbf\u95ee\u3002&#xff08;\u4f46\u662f\u66f4\u63a8\u8350\u4f7f\u7528\u7c7b\u540d\u7684\u65b9\u5f0f&#xff09;<\/p>\n<p>\u975e\u9759\u6001\u7684\u5b9e\u4f8b\u53d8\u91cf\u548c\u975e\u9759\u6001\u7684\u65b9\u6cd5&#061;&#061;\u53ea\u80fd&#061;&#061;\u901a\u8fc7\u201c\u5bf9\u8c61.&#034;\u65b9\u5f0f\u8bbf\u95ee\u3002<\/p>\n<h5>3\u3001this\u548csuper\u7684\u4f7f\u7528<\/h5>\n<h5><span style=\"color:#4d4d4d\">\u9759\u6001\u7684\u65b9\u6cd5\u548c\u9759\u6001\u7684\u4ee3\u7801\u5757\u4e2d&#xff0c;&#061;&#061;\u4e0d\u5141\u8bb8&#061;&#061;\u51fa\u73b0this\u548csuper\u5173\u952e\u5b57&#xff0c;\u5982\u679c\u6709\u91cd\u540d\u95ee\u9898&#xff0c;\u4f7f\u7528\u201c\u7c7b\u540d.\u201d\u8fdb\u884c\u533a\u522b\u3002<\/span><\/h5>\n<p>\u975e\u9759\u6001\u7684\u65b9\u6cd5\u548c\u975e\u9759\u6001\u7684\u4ee3\u7801\u5757\u4e2d&#xff0c;\u53ef\u4ee5\u4f7f\u7528this\u548csuper\u5173\u952e\u5b57\u3002<\/p>\n<hr \/>\n<h4>7.2 \u5355\u4f8b\u6a21\u5f0f&#xff08;\u8865\u5145&#xff09;<\/h4>\n<h5>7.2.1 \u997f\u6c49\u5f0f\u5b9e\u73b0<\/h5>\n<p>class Singleton {<br \/>\n    private static final Singleton instance &#061; new Singleton();<br \/>\n    private Singleton() {}<br \/>\n    public static Singleton getInstance() {<br \/>\n        return instance;<br \/>\n    }<br \/>\n}<\/p>\n<h5>7.2.2 \u61d2\u6c49\u5f0f\u5b9e\u73b0&#xff08;\u7ebf\u7a0b\u5b89\u5168&#xff09;<\/h5>\n<p>class Singleton {<br \/>\n    private static volatile Singleton instance;<br \/>\n    private Singleton() {}<br \/>\n    public static Singleton getInstance() {<br \/>\n        if (instance &#061;&#061; null) {<br \/>\n            synchronized (Singleton.class) {<br \/>\n                if (instance &#061;&#061; null) {<br \/>\n                    instance &#061; new Singleton();<br \/>\n                }<br \/>\n            }<br \/>\n        }<br \/>\n        return instance;<br \/>\n    }<br \/>\n}<\/p>\n<hr \/>\n<h4>7.3 \u679a\u4e3e\u7c7b<\/h4>\n<h5>7.3.1 \u5b9a\u4e49\u4e0e\u4f7f\u7528<\/h5>\n<p>enum Weekday {<br \/>\n    MONDAY, TUESDAY, WEDNESDAY;<br \/>\n}<\/p>\n<ul>\n<li>\u7279\u70b9\n<ul>\n<li>\u5929\u7136\u5355\u4f8b&#xff0c;\u7ebf\u7a0b\u5b89\u5168\u3002<\/li>\n<li>\u53ef\u6dfb\u52a0\u6784\u9020\u5668\u3001\u65b9\u6cd5\u53ca\u5b57\u6bb5&#xff0c;\u5b9e\u73b0\u590d\u6742\u903b\u8f91\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h5>7.3.2 \u679a\u4e3e\u4e0e\u8bbe\u8ba1\u6a21\u5f0f<\/h5>\n<ul>\n<li>\u72b6\u6001\u6a21\u5f0f&#xff1a;\u901a\u8fc7\u679a\u4e3e\u5b9e\u73b0\u72b6\u6001\u673a\u3002<\/li>\n<li>\u7b56\u7565\u6a21\u5f0f&#xff1a;\u679a\u4e3e\u6210\u5458\u5c01\u88c5\u4e0d\u540c\u7b56\u7565\u3002<\/li>\n<\/ul>\n<hr \/>\n<h4>\u5305\u88c5\u7c7b<\/h4>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Java\u63d0\u4f9b\u4e86\u4e24\u4e2a\u7c7b\u578b\u7cfb\u7edf&#xff0c;\u57fa\u672c\u7c7b\u578b\u4e0e\u5f15\u7528\u7c7b\u578b&#xff0c;\u4f7f\u7528\u57fa\u672c\u7c7b\u578b\u5728\u4e8e\u6548\u7387&#xff0c;\u7136\u800c\u5f53\u8981\u4f7f\u7528\u53ea\u9488\u5bf9\u5bf9\u8c61\u8bbe\u8ba1\u7684API\u6216\u65b0\u7279\u6027&#xff08;\u4f8b\u5982\u6cdb\u578b&#xff09;&#xff0c;\u90a3\u4e48\u57fa\u672c\u6570\u636e\u7c7b\u578b\u7684\u6570\u636e\u5c31\u9700\u8981\u7528\u5305\u88c5\u7c7b\u6765\u5305\u88c5\u3002<\/p>\n<h4><\/h4>\n<h4>7.4 \u5185\u90e8\u7c7b<\/h4>\n<h5>7.4.1 \u6210\u5458\u5185\u90e8\u7c7b<\/h5>\n<p>class Outer {<br \/>\n    class Inner {}<br \/>\n}<\/p>\n<ul>\n<li>\u8bbf\u95ee\u89c4\u5219&#xff1a;\u53ef\u8bbf\u95ee\u5916\u90e8\u7c7b\u6240\u6709\u6210\u5458&#xff0c;\u5305\u62ec\u79c1\u6709\u3002<\/li>\n<\/ul>\n<h5>7.4.2 \u9759\u6001\u5185\u90e8\u7c7b<\/h5>\n<p>class Outer {<br \/>\n    static class Inner {}<br \/>\n}<\/p>\n<ul>\n<li>\u7279\u70b9&#xff1a;\u4e0d\u4f9d\u8d56\u5916\u90e8\u7c7b\u5b9e\u4f8b&#xff0c;\u4ec5\u80fd\u8bbf\u95ee\u5916\u90e8\u7c7b\u9759\u6001\u6210\u5458\u3002<\/li>\n<\/ul>\n<h5>7.4.3 \u533f\u540d\u5185\u90e8\u7c7b<\/h5>\n<p>Runnable r &#061; new Runnable() {<br \/>\n    &#064;Override<br \/>\n    public void run() {}<br \/>\n};<\/p>\n<hr \/>\n<h4>7.5 \u4ee3\u7801\u793a\u4f8b\u6574\u5408<\/h4>\n<ul>\n<li>\u9759\u6001\u53d8\u91cf\u793a\u4f8b&#xff1a;Employee\u7c7b\u6f14\u793a\u5171\u4eabcompany\u548ctotal\u3002<\/li>\n<li>\u9759\u6001\u65b9\u6cd5\u793a\u4f8b&#xff1a;Father\u4e0eSon\u7c7b\u5c55\u793a\u7ee7\u627f\u4e0e\u9690\u85cf\u3002<\/li>\n<li>\u9759\u6001\u4ee3\u7801\u5757\u793a\u4f8b&#xff1a;Chinese\u7c7b\u9a8c\u8bc1\u521d\u59cb\u5316\u987a\u5e8f\u3002<\/li>\n<\/ul>\n<p>\u901a\u8fc7\u4ee5\u4e0a\u7ed3\u6784&#xff0c;\u7cfb\u7edf\u5316\u638c\u63e1\u9759\u6001\u6210\u5458\u3001\u5355\u4f8b\u3001\u679a\u4e3e\u548c\u5185\u90e8\u7c7b\u7684\u6838\u5fc3\u6982\u5ff5\u4e0e\u5e94\u7528\u573a\u666f\u3002<\/p>\n<h4><\/h4>\n","protected":false},"excerpt":{"rendered":"<p>\u63d0\u793a&#xff1a;\u672c\u6587\u8bb2\u8ff0\u9759\u6001\u3001\u679a\u4e3e\u3001\u5305\u88c5\u7c7b\u3001\u62bd\u8c61\u7c7b\u3001\u5185\u90e8\u7c7b7.1 \u9759\u60017.1.1 \u9759\u6001\u5173\u952e\u5b57&#xff08;static&#xff09;\u9759\u6001\u5173\u952e\u5b57\u7528\u4e8e\u4fee\u9970\u4e0e\u7c7b\u800c\u975e\u5bf9\u8c61\u5173\u8054\u7684\u6210\u5458\u53d8\u91cf\u548c\u65b9\u6cd5\u3002\u5f53\u6210\u5458\u53d8\u91cf\u6216\u65b9\u6cd5\u4e0e\u7c7b\u7684\u5b9e\u4f8b\u65e0\u5173\u65f6&#xff0c;\u4f7f\u7528static\u53ef\u4ee5\u907f\u514d\u4e3a\u6bcf\u4e2a\u5bf9\u8c61\u5355\u72ec\u5b58\u50a8\u6216\u8c03\u7528&#xff0c;\u63d0\u5347\u6548\u7387\u548c\u4ee3\u7801\u7b80\u6d01\u6027\u30027.1.2 \u9759\u6001\u53d8\u91cf\u8bed\u6cd5\u683c\u5f0f\u3010\u4fee\u9970\u7b26\u3011 class \u7c7b\u540d {\u3010\u5176\u4ed6\u4fee\u9970\u7b26\u3011 static \u6570\u636e\u7c7b\u578b \u53d8\u91cf\u540d;<br \/>\n}\u7279\u70b9\u9ed8\u8ba4\u503c\u4e0e\u5b9e\u4f8b\u53d8\u91cf\u76f8\u540c&#xff08;\u57fa<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[99,2246,190],"topic":[],"class_list":["post-60020","post","type-post","status-publish","format-standard","hentry","category-server","tag-java","tag-2246","tag-190"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Java\u57fa\u7840\u2014\u2014\u9762\u5411\u5bf9\u8c61\uff08\u56db\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/60020.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Java\u57fa\u7840\u2014\u2014\u9762\u5411\u5bf9\u8c61\uff08\u56db\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u63d0\u793a&#xff1a;\u672c\u6587\u8bb2\u8ff0\u9759\u6001\u3001\u679a\u4e3e\u3001\u5305\u88c5\u7c7b\u3001\u62bd\u8c61\u7c7b\u3001\u5185\u90e8\u7c7b7.1 \u9759\u60017.1.1 \u9759\u6001\u5173\u952e\u5b57&#xff08;static&#xff09;\u9759\u6001\u5173\u952e\u5b57\u7528\u4e8e\u4fee\u9970\u4e0e\u7c7b\u800c\u975e\u5bf9\u8c61\u5173\u8054\u7684\u6210\u5458\u53d8\u91cf\u548c\u65b9\u6cd5\u3002\u5f53\u6210\u5458\u53d8\u91cf\u6216\u65b9\u6cd5\u4e0e\u7c7b\u7684\u5b9e\u4f8b\u65e0\u5173\u65f6&#xff0c;\u4f7f\u7528static\u53ef\u4ee5\u907f\u514d\u4e3a\u6bcf\u4e2a\u5bf9\u8c61\u5355\u72ec\u5b58\u50a8\u6216\u8c03\u7528&#xff0c;\u63d0\u5347\u6548\u7387\u548c\u4ee3\u7801\u7b80\u6d01\u6027\u30027.1.2 \u9759\u6001\u53d8\u91cf\u8bed\u6cd5\u683c\u5f0f\u3010\u4fee\u9970\u7b26\u3011 class \u7c7b\u540d {\u3010\u5176\u4ed6\u4fee\u9970\u7b26\u3011 static \u6570\u636e\u7c7b\u578b \u53d8\u91cf\u540d; }\u7279\u70b9\u9ed8\u8ba4\u503c\u4e0e\u5b9e\u4f8b\u53d8\u91cf\u76f8\u540c&#xff08;\u57fa\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/60020.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-01-14T12:57:23+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/60020.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/60020.html\",\"name\":\"Java\u57fa\u7840\u2014\u2014\u9762\u5411\u5bf9\u8c61\uff08\u56db\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-01-14T12:57:23+00:00\",\"dateModified\":\"2026-01-14T12:57:23+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/60020.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/60020.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/60020.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\u57fa\u7840\u2014\u2014\u9762\u5411\u5bf9\u8c61\uff08\u56db\uff09\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Java\u57fa\u7840\u2014\u2014\u9762\u5411\u5bf9\u8c61\uff08\u56db\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/60020.html","og_locale":"zh_CN","og_type":"article","og_title":"Java\u57fa\u7840\u2014\u2014\u9762\u5411\u5bf9\u8c61\uff08\u56db\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u63d0\u793a&#xff1a;\u672c\u6587\u8bb2\u8ff0\u9759\u6001\u3001\u679a\u4e3e\u3001\u5305\u88c5\u7c7b\u3001\u62bd\u8c61\u7c7b\u3001\u5185\u90e8\u7c7b7.1 \u9759\u60017.1.1 \u9759\u6001\u5173\u952e\u5b57&#xff08;static&#xff09;\u9759\u6001\u5173\u952e\u5b57\u7528\u4e8e\u4fee\u9970\u4e0e\u7c7b\u800c\u975e\u5bf9\u8c61\u5173\u8054\u7684\u6210\u5458\u53d8\u91cf\u548c\u65b9\u6cd5\u3002\u5f53\u6210\u5458\u53d8\u91cf\u6216\u65b9\u6cd5\u4e0e\u7c7b\u7684\u5b9e\u4f8b\u65e0\u5173\u65f6&#xff0c;\u4f7f\u7528static\u53ef\u4ee5\u907f\u514d\u4e3a\u6bcf\u4e2a\u5bf9\u8c61\u5355\u72ec\u5b58\u50a8\u6216\u8c03\u7528&#xff0c;\u63d0\u5347\u6548\u7387\u548c\u4ee3\u7801\u7b80\u6d01\u6027\u30027.1.2 \u9759\u6001\u53d8\u91cf\u8bed\u6cd5\u683c\u5f0f\u3010\u4fee\u9970\u7b26\u3011 class \u7c7b\u540d {\u3010\u5176\u4ed6\u4fee\u9970\u7b26\u3011 static \u6570\u636e\u7c7b\u578b \u53d8\u91cf\u540d; }\u7279\u70b9\u9ed8\u8ba4\u503c\u4e0e\u5b9e\u4f8b\u53d8\u91cf\u76f8\u540c&#xff08;\u57fa","og_url":"https:\/\/www.wsisp.com\/helps\/60020.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-01-14T12:57:23+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/60020.html","url":"https:\/\/www.wsisp.com\/helps\/60020.html","name":"Java\u57fa\u7840\u2014\u2014\u9762\u5411\u5bf9\u8c61\uff08\u56db\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-01-14T12:57:23+00:00","dateModified":"2026-01-14T12:57:23+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/60020.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/60020.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/60020.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Java\u57fa\u7840\u2014\u2014\u9762\u5411\u5bf9\u8c61\uff08\u56db\uff09"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/60020","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=60020"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/60020\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=60020"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=60020"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=60020"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=60020"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}