{"id":71591,"date":"2026-02-03T23:04:58","date_gmt":"2026-02-03T15:04:58","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/71591.html"},"modified":"2026-02-03T23:04:58","modified_gmt":"2026-02-03T15:04:58","slug":"%e5%8d%95%e4%be%8b%e6%a8%a1%e5%bc%8f%e7%ac%94%e8%ae%b0","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/71591.html","title":{"rendered":"\u5355\u4f8b\u6a21\u5f0f\u7b14\u8bb0"},"content":{"rendered":"<p>\u514d\u8d39\u7248Java\u5b66\u4e60\u7b14\u8bb0&#xff08;38w\u5b57&#xff09;\u94fe\u63a5&#xff1a;https:\/\/www.yuque.com\/aoyouaoyou\/sgcqr8 \u514d\u8d39\u7248Java\u9762\u8bd5\u9898&#xff08;28w\u5b57&#xff09;\u94fe\u63a5&#xff1a;https:\/\/www.yuque.com\/aoyouaoyou\/wh3hto \u5b8c\u6574\u7248\u53ef\u5728\u5c0f\u7ea2\u4e66\u641c\u7d22&#xff1a;\u9068\u6e38qk0<\/p>\n<\/p>\n<p id=\"uc4a95ada\">\u5355\u4f8b\u6a21\u5f0f\u662f\u521b\u5efa\u578b\u8bbe\u8ba1\u6a21\u5f0f\u4e2d\u6700\u5e38\u7528\u7684\u4e00\u79cd&#xff0c;\u6838\u5fc3\u662f\u4fdd\u8bc1\u67d0\u4e2a\u7c7b\u5728\u7a0b\u5e8f\u8fd0\u884c\u671f\u95f4\u4ec5\u6709\u4e00\u4e2a\u5b9e\u4f8b&#xff0c;\u5e76\u63d0\u4f9b\u5168\u5c40\u7edf\u4e00\u7684\u8bbf\u95ee\u5165\u53e3\u3002\u9002\u7528\u4e8e\u65e5\u5fd7\u5de5\u5177\u3001\u914d\u7f6e\u7ba1\u7406\u3001\u6570\u636e\u5e93\u8fde\u63a5\u6c60\u7b49\u9700\u907f\u514d\u91cd\u590d\u521b\u5efa\u7684\u573a\u666f&#xff0c;\u4e5f\u662f\u9762\u8bd5\u9ad8\u9891\u8003\u70b9\u3002<\/p>\n<p>\u6b64\u5904\u4e3a\u8bed\u96c0\u5185\u5bb9\u5361\u7247&#xff0c;\u70b9\u51fb\u94fe\u63a5\u67e5\u770b&#xff1a;https:\/\/www.yuque.com\/aoyouaoyou\/pw1w5m\/grpkf5br1h3qc2yr<\/p>\n<p id=\"u0da0eeca\">\n<p id=\"u9e64060e\">\u4ee3\u7801\u4f4d\u7f6e&#xff1a;<\/p>\n<p id=\"u0a617e78\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1020\" id=\"u88262f3b\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260203150456-69820e98229ce.png\" width=\"1920\" \/><\/p>\n<h3 id=\"xXB41\">\u4e00\u3001\u5355\u4f8b\u6a21\u5f0f\u5b9a\u4e49\u4e0e\u76ee\u6807<\/h3>\n<h4 id=\"xTWY3\">1. \u5b9a\u4e49<\/h4>\n<p id=\"u5193f0b2\">\u786e\u4fdd\u4e00\u4e2a\u7c7b\u5728\u6574\u4e2a\u5e94\u7528\u751f\u547d\u5468\u671f\u4e2d\u53ea\u6709\u4e00\u4e2a\u5b9e\u4f8b&#xff0c;\u4e14\u8be5\u5b9e\u4f8b\u80fd\u88ab\u5168\u5c40\u8bbf\u95ee&#xff0c;\u907f\u514d\u91cd\u590d\u521b\u5efa\u5bf9\u8c61\u5bfc\u81f4\u7684\u8d44\u6e90\u6d6a\u8d39&#xff08;\u5982\u5185\u5b58\u3001CPU&#xff09;\u3002<\/p>\n<h4 id=\"S5fbL\">2. \u76ee\u6807<\/h4>\n<ul>\n<li id=\"u59c6f22e\">\u9650\u5236\u5b9e\u4f8b\u6570\u91cf&#xff1a;\u4ec5\u5141\u8bb8\u521b\u5efa\u4e00\u4e2a\u5b9e\u4f8b&#xff1b;<\/li>\n<li id=\"u598a01df\">\u5168\u5c40\u8bbf\u95ee&#xff1a;\u63d0\u4f9b\u7edf\u4e00\u7684\u9759\u6001\u65b9\u6cd5\u4f9b\u5916\u90e8\u83b7\u53d6\u5b9e\u4f8b&#xff1b;<\/li>\n<li id=\"uac1a5c09\">\u7ebf\u7a0b\u5b89\u5168&#xff1a;\u591a\u7ebf\u7a0b\u73af\u5883\u4e0b\u4ecd\u80fd\u4fdd\u8bc1\u5b9e\u4f8b\u552f\u4e00\u6027\u3002<\/li>\n<\/ul>\n<h3 id=\"Wg1mb\">\u4e8c\u3001\u5355\u4f8b\u6a21\u5f0f6\u79cd\u5b9e\u73b0\u65b9\u5f0f<\/h3>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"450\" id=\"u1e977ac4\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260203150456-69820e98b837a.png\" width=\"810\" \/><\/p>\n<h4 id=\"TvQ8g\">1. \u997f\u6c49\u5f0f&#xff08;\u9884\u52a0\u8f7d&#xff09;<\/h4>\n<p id=\"u5d1a724c\">\u6838\u5fc3\u539f\u7406<\/p>\n<p id=\"udcf4da6f\">\u7c7b\u52a0\u8f7d\u65f6\u76f4\u63a5\u521d\u59cb\u5316\u9759\u6001\u5b9e\u4f8b&#xff0c;\u7531JVM\u4fdd\u8bc1\u7ebf\u7a0b\u5b89\u5168&#xff08;\u7c7b\u52a0\u8f7d\u8fc7\u7a0b\u662f\u5355\u7ebf\u7a0b\u7684&#xff09;\u3002<\/p>\n<p id=\"u2247fd41\">\u4ee3\u7801\u5b9e\u73b0<\/p>\n<p>\/**<br \/>\n * \u997f\u6c49\u5f0f\u5355\u4f8b&#xff1a;\u7c7b\u52a0\u8f7d\u65f6\u521b\u5efa\u5b9e\u4f8b&#xff0c;\u4e0d\u652f\u6301\u61d2\u52a0\u8f7d<br \/>\n *\/<br \/>\npublic class CityServiceCenter {<br \/>\n    \/\/ 1. \u79c1\u6709\u6784\u9020\u65b9\u6cd5&#xff1a;\u7981\u6b62\u5916\u90e8\u901a\u8fc7new\u521b\u5efa\u5b9e\u4f8b<br \/>\n    private CityServiceCenter() {}<\/p>\n<p>    \/\/ 2. \u79c1\u6709\u9759\u6001\u5b9e\u4f8b&#xff1a;\u7c7b\u52a0\u8f7d\u65f6\u521d\u59cb\u5316&#xff08;\u9884\u52a0\u8f7d&#xff09;<br \/>\n    private static final CityServiceCenter INSTANCE &#061; new CityServiceCenter();<\/p>\n<p>    \/\/ 3. \u5168\u5c40\u8bbf\u95ee\u65b9\u6cd5&#xff1a;\u8fd4\u56de\u552f\u4e00\u5b9e\u4f8b<br \/>\n    public static CityServiceCenter getInstance() {<br \/>\n        return INSTANCE;<br \/>\n    }<\/p>\n<p>    \/\/ \u793a\u4f8b\u4e1a\u52a1\u65b9\u6cd5<br \/>\n    public void handleBusiness(String userName) {<br \/>\n        System.out.println(userName &#043; &#034; \u6b63\u5728\u5e02\u653f\u670d\u52a1\u4e2d\u5fc3\u529e\u7406\u4e1a\u52a1&#034;);<br \/>\n    }<br \/>\n}<br \/>\n\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<br \/>\n\u2502                    CityServiceCenter                        \u2502<br \/>\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524<br \/>\n\u2502 &#8211; INSTANCE: CityServiceCenter &#061; new CityServiceCenter()     \u2502<br \/>\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524<br \/>\n\u2502 &#8211; CityServiceCenter()                                       \u2502<br \/>\n\u2502 &#043; getInstance(): CityServiceCenter                          \u2502<br \/>\n\u2502 &#043; handleBusiness(String): void                              \u2502<br \/>\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518<\/p>\n<p>\u65f6\u5e8f\u6d41\u7a0b&#xff1a;<br \/>\nClient \u2192 getInstance() \u2192 INSTANCE<br \/>\n    \u7c7b\u52a0\u8f7d\u65f6\u5df2\u521d\u59cb\u5316 <\/p>\n<p id=\"uc4ebc86c\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"481\" id=\"lS4Uq\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260203150456-69820e98d79e0.png\" width=\"436\" \/><\/p>\n<p id=\"u6f0a97e1\">\u7279\u70b9<\/p>\n<ul>\n<li id=\"ub8ca5795\">\u4f18\u70b9&#xff1a;\u5b9e\u73b0\u7b80\u5355\u3001\u7ebf\u7a0b\u5b89\u5168\u3001\u83b7\u53d6\u5b9e\u4f8b\u901f\u5ea6\u5feb&#xff1b;<\/li>\n<li id=\"u678cfd57\">\u7f3a\u70b9&#xff1a;\u4e0d\u652f\u6301\u61d2\u52a0\u8f7d&#xff08;\u7c7b\u52a0\u8f7d\u65f6\u5c31\u521b\u5efa\u5b9e\u4f8b&#xff09;&#xff0c;\u82e5\u5b9e\u4f8b\u5360\u7528\u8d44\u6e90\u5927\u4e14\u957f\u671f\u672a\u4f7f\u7528&#xff0c;\u4f1a\u9020\u6210\u5185\u5b58\u6d6a\u8d39&#xff1b;<\/li>\n<li id=\"ua03fce5a\">\u9002\u7528\u573a\u666f&#xff1a;\u5b9e\u4f8b\u4f53\u79ef\u5c0f\u3001\u542f\u52a8\u65f6\u5fc5\u7528\u7684\u573a\u666f&#xff08;\u5982\u914d\u7f6e\u7c7b&#xff09;\u3002<\/li>\n<\/ul>\n<h4 id=\"sE1oT\">2. \u61d2\u6c49\u5f0f&#xff08;\u61d2\u52a0\u8f7d-\u7ebf\u7a0b\u4e0d\u5b89\u5168&#xff09;<\/h4>\n<p id=\"ubed6b56e\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"303\" id=\"u63700557\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260203150456-69820e98e9cd3.png\" width=\"1078\" \/><\/p>\n<p id=\"ud690674c\">\u6838\u5fc3\u539f\u7406<\/p>\n<p id=\"u7ebc8392\">\u4ec5\u5f53\u5916\u90e8\u8c03\u7528getInstance()\u65b9\u6cd5\u65f6\u624d\u521b\u5efa\u5b9e\u4f8b&#xff0c;\u652f\u6301\u61d2\u52a0\u8f7d&#xff0c;\u4f46\u591a\u7ebf\u7a0b\u73af\u5883\u4e0b\u5b58\u5728\u7ebf\u7a0b\u5b89\u5168\u95ee\u9898\u3002<\/p>\n<p id=\"u090fc3e5\">\u4ee3\u7801\u5b9e\u73b0<\/p>\n<p>\/**<br \/>\n * \u61d2\u6c49\u5f0f\u5355\u4f8b&#xff1a;\u61d2\u52a0\u8f7d&#xff0c;\u7ebf\u7a0b\u4e0d\u5b89\u5168&#xff08;\u591a\u7ebf\u7a0b\u4e0b\u53ef\u80fd\u521b\u5efa\u591a\u4e2a\u5b9e\u4f8b&#xff09;<br \/>\n *\/<br \/>\npublic class WaterSupplySystem {<br \/>\n    \/\/ 1. \u79c1\u6709\u6784\u9020\u65b9\u6cd5<br \/>\n    private WaterSupplySystem() {}<\/p>\n<p>    \/\/ 2. \u79c1\u6709\u9759\u6001\u5b9e\u4f8b&#xff1a;\u521d\u59cb\u4e3anull&#xff0c;\u4e0d\u9884\u52a0\u8f7d<br \/>\n    private static WaterSupplySystem instance;<\/p>\n<p>    \/\/ 3. \u5168\u5c40\u8bbf\u95ee\u65b9\u6cd5&#xff1a;\u8c03\u7528\u65f6\u624d\u521b\u5efa\u5b9e\u4f8b<br \/>\n    public static WaterSupplySystem getInstance() {<br \/>\n        \/\/ \u672a\u52a0\u9501&#xff1a;\u591a\u7ebf\u7a0b\u53ef\u80fd\u540c\u65f6\u8fdb\u5165\u5224\u65ad&#xff0c;\u521b\u5efa\u591a\u4e2a\u5b9e\u4f8b<br \/>\n        if (instance &#061;&#061; null) {<br \/>\n            instance &#061; new WaterSupplySystem();<br \/>\n        }<br \/>\n        return instance;<br \/>\n    }<\/p>\n<p>    \/\/ \u793a\u4f8b\u4e1a\u52a1\u65b9\u6cd5<br \/>\n    public void supplyWater(String area) {<br \/>\n        System.out.println(&#034;\u4e3a &#034; &#043; area &#043; &#034; \u533a\u57df\u4f9b\u6c34&#034;);<br \/>\n    }<br \/>\n}<br \/>\n\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<br \/>\n\u2502                    WaterSupplySystem                        \u2502<br \/>\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524<br \/>\n\u2502 &#8211; instance: WaterSupplySystem &#061; null                        \u2502<br \/>\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524<br \/>\n\u2502 &#8211; WaterSupplySystem()                                       \u2502<br \/>\n\u2502 &#043; getInstance(): WaterSupplySystem                          \u2502<br \/>\n\u2502 &#043; supplyWater(String): void                                 \u2502<br \/>\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518<\/p>\n<p>\u65f6\u5e8f\u6d41\u7a0b&#xff1a;<br \/>\nClient \u2192 getInstance() \u2192 if(instance&#061;&#061;null) \u2192 new instance<br \/>\n    \u591a\u7ebf\u7a0b\u4e0b\u53ef\u80fd\u521b\u5efa\u591a\u4e2a\u5b9e\u4f8b <\/p>\n<p id=\"ub5fb399d\">\u7279\u70b9<\/p>\n<ul>\n<li id=\"u184a5831\">\u4f18\u70b9&#xff1a;\u652f\u6301\u61d2\u52a0\u8f7d&#xff0c;\u8282\u7701\u5185\u5b58&#xff1b;<\/li>\n<li id=\"uaebc54be\">\u7f3a\u70b9&#xff1a;\u7ebf\u7a0b\u4e0d\u5b89\u5168&#xff08;\u591a\u7ebf\u7a0b\u5e76\u53d1\u8c03\u7528\u65f6\u53ef\u80fd\u521b\u5efa\u591a\u4e2a\u5b9e\u4f8b&#xff09;&#xff1b;<\/li>\n<li id=\"ud7035191\">\u9002\u7528\u573a\u666f&#xff1a;\u5355\u7ebf\u7a0b\u73af\u5883&#xff0c;\u6216\u4e0d\u5173\u6ce8\u7ebf\u7a0b\u5b89\u5168\u7684\u7b80\u5355\u573a\u666f&#xff08;\u4e0d\u63a8\u8350\u751f\u4ea7\u4f7f\u7528&#xff09;\u3002<\/li>\n<\/ul>\n<h4 id=\"EiGgh\">3. \u61d2\u6c49\u5f0f&#xff08;\u61d2\u52a0\u8f7d-\u7ebf\u7a0b\u5b89\u5168&#xff09;<\/h4>\n<p id=\"ud7c584a8\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"303\" id=\"uf2c34264\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260203150457-69820e9921f91.png\" width=\"1078\" \/><\/p>\n<p id=\"u2760a99a\">\u6838\u5fc3\u539f\u7406<\/p>\n<p id=\"u5e21132a\">\u5728getInstance()\u65b9\u6cd5\u4e0a\u6dfb\u52a0synchronized\u540c\u6b65\u9501&#xff0c;\u5f3a\u5236\u591a\u7ebf\u7a0b\u4e32\u884c\u6267\u884c&#xff0c;\u907f\u514d\u5e76\u53d1\u521b\u5efa\u5b9e\u4f8b\u3002<\/p>\n<p id=\"ufe0fb1d9\">\u4ee3\u7801\u5b9e\u73b0<\/p>\n<p>\/**<br \/>\n * \u61d2\u6c49\u5f0f\u5355\u4f8b&#xff1a;\u61d2\u52a0\u8f7d&#043;\u540c\u6b65\u9501&#xff0c;\u7ebf\u7a0b\u5b89\u5168\u4f46\u6027\u80fd\u4f4e<br \/>\n *\/<br \/>\npublic class PowerGridControl {<br \/>\n    \/\/ 1. \u79c1\u6709\u6784\u9020\u65b9\u6cd5<br \/>\n    private PowerGridControl() {}<\/p>\n<p>    \/\/ 2. \u79c1\u6709\u9759\u6001\u5b9e\u4f8b<br \/>\n    private static PowerGridControl instance;<\/p>\n<p>    \/\/ 3. \u540c\u6b65\u65b9\u6cd5&#xff1a;\u4fdd\u8bc1\u591a\u7ebf\u7a0b\u4e32\u884c\u8c03\u7528<br \/>\n    public static synchronized PowerGridControl getInstance() {<br \/>\n        if (instance &#061;&#061; null) {<br \/>\n            instance &#061; new PowerGridControl();<br \/>\n        }<br \/>\n        return instance;<br \/>\n    }<\/p>\n<p>    \/\/ \u793a\u4f8b\u4e1a\u52a1\u65b9\u6cd5<br \/>\n    public void adjustPower(String region) {<br \/>\n        System.out.println(&#034;\u8c03\u6574 &#034; &#043; region &#043; &#034; \u533a\u57df\u7535\u7f51\u8d1f\u8377&#034;);<br \/>\n    }<br \/>\n}<br \/>\n\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<br \/>\n\u2502                    PowerGridControl                         \u2502<br \/>\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524<br \/>\n\u2502 &#8211; instance: PowerGridControl &#061; null                         \u2502<br \/>\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524<br \/>\n\u2502 &#8211; PowerGridControl()                                        \u2502<br \/>\n\u2502 &#043; getInstance(): synchronized PowerGridControl              \u2502<br \/>\n\u2502 &#043; adjustPower(String): void                                 \u2502<br \/>\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518<\/p>\n<p>\u65f6\u5e8f\u6d41\u7a0b&#xff1a;<br \/>\nThread1 \u2192 getInstance() \u2192 [LOCK] \u2192 if(instance&#061;&#061;null) \u2192 new instance<br \/>\nThread2 \u2192 \u7b49\u5f85\u9501\u91ca\u653e \u2192 [LOCK] \u2192 \u76f4\u63a5\u8fd4\u56deinstance <\/p>\n<p id=\"u3314a475\">\u7279\u70b9<\/p>\n<ul>\n<li id=\"uc20acf22\">\u4f18\u70b9&#xff1a;\u7ebf\u7a0b\u5b89\u5168\u3001\u652f\u6301\u61d2\u52a0\u8f7d&#xff1b;<\/li>\n<li id=\"u72a7b127\">\u7f3a\u70b9&#xff1a;\u6027\u80fd\u74f6\u9888&#xff08;\u540c\u6b65\u9501\u5bfc\u81f4\u591a\u7ebf\u7a0b\u4e32\u884c\u6267\u884c&#xff0c;\u5e76\u53d1\u5ea6\u4e3a1&#xff09;&#xff1b;<\/li>\n<li id=\"u555016a1\">\u9002\u7528\u573a\u666f&#xff1a;\u4f4e\u5e76\u53d1\u573a\u666f&#xff0c;\u5bf9\u6027\u80fd\u8981\u6c42\u4e0d\u9ad8\u7684\u4e1a\u52a1\u3002<\/li>\n<\/ul>\n<h4 id=\"kG4y4\">4. \u53cc\u91cd\u6821\u9a8c\u9501&#xff08;DCL&#xff1a;Double-Check Locking&#xff09;<\/h4>\n<p id=\"u454bb595\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"337\" id=\"u9c123676\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260203150457-69820e9950c6f.png\" width=\"634\" \/><\/p>\n<p id=\"u454bb595\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"581\" id=\"ubc2c1c3f\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260203150457-69820e99690a2.png\" width=\"467\" \/><\/p>\n<p id=\"ub49a674e\">\u6838\u5fc3\u539f\u7406<\/p>\n<p id=\"u9f42a1aa\">\u7ed3\u5408\u201c\u61d2\u52a0\u8f7d&#043;\u540c\u6b65\u4ee3\u7801\u5757&#043;volatile\u5173\u952e\u5b57\u201d&#xff0c;\u65e2\u4fdd\u8bc1\u7ebf\u7a0b\u5b89\u5168&#xff0c;\u53c8\u63d0\u5347\u5e76\u53d1\u6027\u80fd&#xff08;\u4ec5\u521d\u59cb\u5316\u65f6\u52a0\u9501&#xff0c;\u540e\u7eed\u83b7\u53d6\u5b9e\u4f8b\u65e0\u9700\u9501&#xff09;\u3002<\/p>\n<p id=\"u4237853c\">\u4ee3\u7801\u5b9e\u73b0<\/p>\n<p>\/**<br \/>\n * \u53cc\u91cd\u6821\u9a8c\u9501\u5355\u4f8b&#xff1a;\u61d2\u52a0\u8f7d&#043;\u9ad8\u5e76\u53d1&#043;\u7ebf\u7a0b\u5b89\u5168&#xff08;\u63a8\u8350\u751f\u4ea7\u4f7f\u7528&#xff09;<br \/>\n *\/<br \/>\npublic class TrafficControlSystem {<br \/>\n    \/\/ 1. \u79c1\u6709\u6784\u9020\u65b9\u6cd5<br \/>\n    private TrafficControlSystem() {}<\/p>\n<p>    \/\/ 2. \u79c1\u6709\u9759\u6001\u5b9e\u4f8b&#xff1a;volatile\u5173\u952e\u5b57\u7981\u6b62\u6307\u4ee4\u91cd\u6392\u5e8f<br \/>\n    private static volatile TrafficControlSystem instance;<\/p>\n<p>    \/\/ 3. \u53cc\u91cd\u6821\u9a8c&#043;\u540c\u6b65\u4ee3\u7801\u5757<br \/>\n    public static TrafficControlSystem getInstance() {<br \/>\n        \/\/ \u7b2c\u4e00\u6b21\u6821\u9a8c&#xff1a;\u907f\u514d\u5df2\u521b\u5efa\u5b9e\u4f8b\u540e\u4ecd\u8fdb\u5165\u540c\u6b65\u4ee3\u7801\u5757&#xff08;\u63d0\u5347\u6027\u80fd&#xff09;<br \/>\n        if (instance &#061;&#061; null) {<br \/>\n            \/\/ \u540c\u6b65\u9501&#xff1a;\u9501\u5b9a\u7c7b\u5bf9\u8c61&#xff0c;\u4fdd\u8bc1\u521d\u59cb\u5316\u65f6\u5355\u7ebf\u7a0b\u6267\u884c<br \/>\n            synchronized (TrafficControlSystem.class) {<br \/>\n                \/\/ \u7b2c\u4e8c\u6b21\u6821\u9a8c&#xff1a;\u9632\u6b62\u591a\u7ebf\u7a0b\u540c\u65f6\u7b49\u5f85\u9501\u540e\u91cd\u590d\u521b\u5efa\u5b9e\u4f8b<br \/>\n                if (instance &#061;&#061; null) {<br \/>\n                    instance &#061; new TrafficControlSystem();<br \/>\n                }<br \/>\n            }<br \/>\n        }<br \/>\n        return instance;<br \/>\n    }<\/p>\n<p>    \/\/ \u793a\u4f8b\u4e1a\u52a1\u65b9\u6cd5<br \/>\n    public void controlTrafficLight(String intersection) {<br \/>\n        System.out.println(&#034;\u63a7\u5236 &#034; &#043; intersection &#043; &#034; \u8def\u53e3\u7ea2\u7eff\u706f&#034;);<br \/>\n    }<br \/>\n}<br \/>\n\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<br \/>\n\u2502                  TrafficControlSystem                       \u2502<br \/>\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524<br \/>\n\u2502 &#8211; instance: volatile TrafficControlSystem &#061; null            \u2502<br \/>\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524<br \/>\n\u2502 &#8211; TrafficControlSystem()                                    \u2502<br \/>\n\u2502 &#043; getInstance(): TrafficControlSystem                       \u2502<br \/>\n\u2502 &#043; controlTrafficLight(String): void                         \u2502<br \/>\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518<\/p>\n<p>\u65f6\u5e8f\u6d41\u7a0b&#xff1a;<br \/>\nThread1 \u2192 getInstance() \u2192 if(instance&#061;&#061;null) \u2192 [LOCK] \u2192 if(instance&#061;&#061;null) \u2192 new instance<br \/>\nThread2 \u2192 getInstance() \u2192 if(instance!&#061;null) \u2192 \u76f4\u63a5\u8fd4\u56deinstance (\u65e0\u9501) <\/p>\n<h5 id=\"iKbG3\">\u5173\u952e\u8bf4\u660e&#xff1a;volatile\u5173\u952e\u5b57\u7684\u4f5c\u7528<\/h5>\n<p id=\"u74429307\">instance &#061; new TrafficControlSystem() \u5e76\u975e\u539f\u5b50\u64cd\u4f5c&#xff0c;JVM\u4f1a\u62c6\u5206\u4e3a3\u6b65&#xff1a;<\/p>\n<li id=\"u49d7c4f0\">\u5206\u914d\u5185\u5b58\u7a7a\u95f4&#xff1b;<\/li>\n<li id=\"u508a24b1\">\u521d\u59cb\u5316\u5b9e\u4f8b&#xff1b;<\/li>\n<li id=\"u1d8c1329\">\u5c06instance\u6307\u5411\u5185\u5b58\u7a7a\u95f4\u3002<\/li>\n<p id=\"uf9f26542\">\u82e5\u65e0volatile&#xff0c;JVM\u53ef\u80fd\u6307\u4ee4\u91cd\u6392\u5e8f&#xff08;\u6267\u884c\u987a\u5e8f\u53d8\u4e3a1\u21923\u21922&#xff09;&#xff0c;\u5bfc\u81f4\u7ebf\u7a0bA\u672a\u5b8c\u6210\u521d\u59cb\u5316\u65f6&#xff0c;\u7ebf\u7a0bB\u8bfb\u53d6\u5230\u975enull\u4f46\u672a\u521d\u59cb\u5316\u7684\u5b9e\u4f8b&#xff0c;\u5f15\u53d1\u7a7a\u6307\u9488\u5f02\u5e38\u3002volatile\u53ef\u7981\u6b62\u6307\u4ee4\u91cd\u6392\u5e8f&#xff0c;\u4fdd\u8bc1\u5b9e\u4f8b\u521d\u59cb\u5316\u5b8c\u6574\u3002<\/p>\n<p id=\"uebb27cbd\">\u7279\u70b9<\/p>\n<ul>\n<li id=\"u0221d734\">\u4f18\u70b9&#xff1a;\u7ebf\u7a0b\u5b89\u5168\u3001\u652f\u6301\u61d2\u52a0\u8f7d\u3001\u9ad8\u5e76\u53d1\u6027\u80fd\u597d&#xff1b;<\/li>\n<li id=\"u9ff62bf4\">\u7f3a\u70b9&#xff1a;\u5b9e\u73b0\u7a0d\u590d\u6742&#xff0c;\u9700\u7406\u89e3volatile\u5173\u952e\u5b57\u4f5c\u7528&#xff1b;<\/li>\n<li id=\"ub45a72a9\">\u9002\u7528\u573a\u666f&#xff1a;\u9ad8\u5e76\u53d1\u751f\u4ea7\u73af\u5883&#xff08;\u6700\u5e38\u7528\u7684\u5b9e\u73b0\u65b9\u5f0f&#xff09;\u3002<\/li>\n<\/ul>\n<h4 id=\"IlviK\">5. \u9759\u6001\u5185\u90e8\u7c7b&#xff08;\u63a8\u8350&#xff09;<\/h4>\n<p id=\"udc1f6d04\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"446\" id=\"u1b7a1c55\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260203150457-69820e99838ee.png\" width=\"619\" \/><\/p>\n<p id=\"udc6cd4ec\">\u6838\u5fc3\u539f\u7406<\/p>\n<p id=\"ua3cabc89\">\u5229\u7528\u9759\u6001\u5185\u90e8\u7c7b\u7684\u7279\u6027&#xff1a;\u5916\u90e8\u7c7b\u52a0\u8f7d\u65f6\u4e0d\u4f1a\u52a0\u8f7d\u5185\u90e8\u7c7b&#xff0c;\u4ec5\u5f53\u8c03\u7528getInstance()\u65f6\u624d\u52a0\u8f7d\u5185\u90e8\u7c7b\u5e76\u521d\u59cb\u5316\u5b9e\u4f8b&#xff0c;\u7531JVM\u4fdd\u8bc1\u7ebf\u7a0b\u5b89\u5168\u3002<\/p>\n<p id=\"u6b024eb0\">\u4ee3\u7801\u5b9e\u73b0<\/p>\n<p>\/**<br \/>\n * \u9759\u6001\u5185\u90e8\u7c7b\u5355\u4f8b&#xff1a;\u61d2\u52a0\u8f7d&#043;\u7ebf\u7a0b\u5b89\u5168&#043;\u5b9e\u73b0\u7b80\u6d01&#xff08;\u63a8\u8350\u751f\u4ea7\u4f7f\u7528&#xff09;<br \/>\n *\/<br \/>\npublic class EnvironmentalMonitor {<br \/>\n    \/\/ 1. \u79c1\u6709\u6784\u9020\u65b9\u6cd5<br \/>\n    private EnvironmentalMonitor() {}<\/p>\n<p>    \/\/ 2. \u9759\u6001\u5185\u90e8\u7c7b&#xff1a;\u4ec5\u5f53\u88ab\u8c03\u7528\u65f6\u624d\u52a0\u8f7d<br \/>\n    private static class MonitorHolder {<br \/>\n        \/\/ \u5185\u90e8\u7c7b\u4e2d\u521d\u59cb\u5316\u5916\u90e8\u7c7b\u5b9e\u4f8b<br \/>\n        private static final EnvironmentalMonitor INSTANCE &#061; new EnvironmentalMonitor();<br \/>\n    }<\/p>\n<p>    \/\/ 3. \u5168\u5c40\u8bbf\u95ee\u65b9\u6cd5&#xff1a;\u89e6\u53d1\u5185\u90e8\u7c7b\u52a0\u8f7d<br \/>\n    public static EnvironmentalMonitor getInstance() {<br \/>\n        return MonitorHolder.INSTANCE;<br \/>\n    }<\/p>\n<p>    \/\/ \u793a\u4f8b\u4e1a\u52a1\u65b9\u6cd5<br \/>\n    public void detectAirQuality(String city) {<br \/>\n        System.out.println(&#034;\u68c0\u6d4b &#034; &#043; city &#043; &#034; \u7a7a\u6c14\u8d28\u91cf&#xff1a;\u4f18&#034;);<br \/>\n    }<br \/>\n}<br \/>\n\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<br \/>\n\u2502                  EnvironmentalMonitor                       \u2502<br \/>\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524<br \/>\n\u2502 &#8211; EnvironmentalMonitor()                                    \u2502<br \/>\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524<br \/>\n\u2502 &#043; getInstance(): EnvironmentalMonitor                       \u2502<br \/>\n\u2502 &#043; detectAirQuality(String): void                            \u2502<br \/>\n\u2502 \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510 \u2502<br \/>\n\u2502 \u2502              static class MonitorHolder                 \u2502 \u2502<br \/>\n\u2502 \u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524 \u2502<br \/>\n\u2502 \u2502 &#8211; INSTANCE: EnvironmentalMonitor &#061; new instance         \u2502 \u2502<br \/>\n\u2502 \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518 \u2502<br \/>\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518<\/p>\n<p>\u65f6\u5e8f\u6d41\u7a0b&#xff1a;<br \/>\nClient \u2192 getInstance() \u2192 MonitorHolder.INSTANCE<br \/>\n    \u9996\u6b21\u8c03\u7528\u65f6\u52a0\u8f7d\u5185\u90e8\u7c7b\u5e76\u521d\u59cb\u5316\u5b9e\u4f8b <\/p>\n<p id=\"u8e8b5aa8\">\u7279\u70b9<\/p>\n<ul>\n<li id=\"ufe2775ac\">\u4f18\u70b9&#xff1a;\u7ebf\u7a0b\u5b89\u5168&#xff08;JVM\u52a0\u8f7d\u5185\u90e8\u7c7b\u65f6\u5355\u7ebf\u7a0b&#xff09;\u3001\u652f\u6301\u61d2\u52a0\u8f7d\u3001\u5b9e\u73b0\u7b80\u6d01\u3001\u65e0\u6027\u80fd\u635f\u8017&#xff1b;<\/li>\n<li id=\"u1bf24efc\">\u7f3a\u70b9&#xff1a;\u65e0\u6cd5\u901a\u8fc7\u53cd\u5c04\u9632\u6b62\u5b9e\u4f8b\u7834\u574f&#xff08;\u9700\u989d\u5916\u5904\u7406&#xff09;&#xff1b;<\/li>\n<li id=\"uae189ef6\">\u9002\u7528\u573a\u666f&#xff1a;\u5927\u591a\u6570\u751f\u4ea7\u73af\u5883&#xff0c;\u517c\u987e\u7b80\u6d01\u6027\u4e0e\u6027\u80fd\u3002<\/li>\n<\/ul>\n<h4 id=\"h5G7A\">6. \u679a\u4e3e\u5355\u4f8b&#xff08;\u300aEffective Java\u300b\u63a8\u8350&#xff09;<\/h4>\n<p>\u6b64\u5904\u4e3a\u8bed\u96c0\u5185\u5bb9\u5361\u7247&#xff0c;\u70b9\u51fb\u94fe\u63a5\u67e5\u770b&#xff1a;https:\/\/www.yuque.com\/aoyouaoyou\/pbz18g\/hx9h4u1ufedbkn4a<\/p>\n<p id=\"u8647bd9f\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"304\" id=\"uf39c984e\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260203150457-69820e999a9c1.png\" width=\"452\" \/><\/p>\n<p id=\"uf92d3a39\">\u6838\u5fc3\u539f\u7406<\/p>\n<p id=\"uc1ba53db\">\u5229\u7528Java\u679a\u4e3e\u7684\u7279\u6027&#xff1a;\u679a\u4e3e\u5b9e\u4f8b\u9ed8\u8ba4\u7ebf\u7a0b\u5b89\u5168\u3001\u4ec5\u521d\u59cb\u5316\u4e00\u6b21&#xff0c;\u4e14\u5929\u7136\u9632\u6b62\u53cd\u5c04\u548c\u5e8f\u5217\u5316\u7834\u574f\u5355\u4f8b\u3002<\/p>\n<p id=\"ud0ad649e\">\u4ee3\u7801\u5b9e\u73b0<\/p>\n<p>\/**<br \/>\n * \u679a\u4e3e\u5355\u4f8b&#xff1a;\u7ebf\u7a0b\u5b89\u5168&#043;\u9632\u53cd\u5c04&#043;\u9632\u5e8f\u5217\u5316&#xff08;\u6700\u7a33\u5b9a\u7684\u5b9e\u73b0\u65b9\u5f0f&#xff09;<br \/>\n *\/<br \/>\npublic enum WeatherForecastSystem {<br \/>\n    \/\/ \u552f\u4e00\u679a\u4e3e\u5b9e\u4f8b&#xff08;\u7b49\u4ef7\u4e8e\u5355\u4f8b\u5b9e\u4f8b&#xff09;<br \/>\n    INSTANCE;<\/p>\n<p>    \/\/ \u679a\u4e3e\u7c7b\u53ef\u5b9a\u4e49\u5c5e\u6027\u548c\u65b9\u6cd5<br \/>\n    private String latestForecast;<\/p>\n<p>    \/\/ \u793a\u4f8b\u4e1a\u52a1\u65b9\u6cd5<br \/>\n    public void updateForecast(String forecast) {<br \/>\n        this.latestForecast &#061; forecast;<br \/>\n        System.out.println(&#034;\u66f4\u65b0\u5929\u6c14\u9884\u62a5&#xff1a;&#034; &#043; forecast);<br \/>\n    }<\/p>\n<p>    public String getLatestForecast() {<br \/>\n        return latestForecast;<br \/>\n    }<br \/>\n}<br \/>\n\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<br \/>\n\u2502                WeatherForecastSystem (enum)                 \u2502<br \/>\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524<br \/>\n\u2502 INSTANCE                                                    \u2502<br \/>\n\u2502 &#8211; latestForecast: String                                    \u2502<br \/>\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524<br \/>\n\u2502 &#043; updateForecast(String): void                              \u2502<br \/>\n\u2502 &#043; getLatestForecast(): String                               \u2502<br \/>\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518<\/p>\n<p>\u4f7f\u7528\u65b9\u5f0f&#xff1a;<br \/>\nWeatherForecastSystem.INSTANCE.updateForecast(&#034;\u6674&#034;) <\/p>\n<p id=\"u5d75d03d\">\u7279\u70b9<\/p>\n<ul>\n<li id=\"uf90efa70\">\u4f18\u70b9&#xff1a;<\/li>\n<\/ul>\n<li>\n<li id=\"u8114414d\">\u7ebf\u7a0b\u5b89\u5168&#xff1a;\u679a\u4e3e\u5b9e\u4f8b\u7531JVM\u4fdd\u8bc1\u4ec5\u521d\u59cb\u5316\u4e00\u6b21&#xff1b;<\/li>\n<li id=\"u31b876b9\">\u9632\u53cd\u5c04&#xff1a;Java\u7981\u6b62\u901a\u8fc7\u53cd\u5c04\u521b\u5efa\u679a\u4e3e\u5b9e\u4f8b&#xff1b;<\/li>\n<li id=\"u9f57f034\">\u9632\u5e8f\u5217\u5316&#xff1a;\u679a\u4e3e\u5e8f\u5217\u5316\u65f6\u4ec5\u5b58\u50a8\u540d\u79f0&#xff0c;\u53cd\u5e8f\u5217\u5316\u65f6\u901a\u8fc7\u540d\u79f0\u83b7\u53d6\u539f\u6709\u5b9e\u4f8b&#xff0c;\u4e0d\u4f1a\u521b\u5efa\u65b0\u5b9e\u4f8b&#xff1b;<\/li>\n<li id=\"ue8478b8e\">\u5b9e\u73b0\u6781\u7b80&#xff1b;<\/li>\n<\/li>\n<ul>\n<li id=\"ubeac4a9c\">\u7f3a\u70b9&#xff1a;\u4e0d\u652f\u6301\u61d2\u52a0\u8f7d&#xff08;\u679a\u4e3e\u7c7b\u52a0\u8f7d\u65f6\u521d\u59cb\u5316\u5b9e\u4f8b&#xff09;&#xff1b;<\/li>\n<li id=\"u7f37f54d\">\u9002\u7528\u573a\u666f&#xff1a;\u5bf9\u5355\u4f8b\u7a33\u5b9a\u6027\u8981\u6c42\u6781\u9ad8\u7684\u573a\u666f&#xff08;\u5982\u6838\u5fc3\u914d\u7f6e\u3001\u652f\u4ed8\u7cfb\u7edf&#xff09;\u3002<\/li>\n<\/ul>\n<h3 id=\"EshfS\">\u4e09\u3001\u5355\u4f8b\u6a21\u5f0f\u7684\u7834\u574f\u4e0e\u89e3\u51b3\u65b9\u6848<\/h3>\n<h4 id=\"EfGeH\">1. \u53cd\u5c04\u7834\u574f\u53ca\u9632\u62a4<\/h4>\n<h5 id=\"LcobZ\">\u95ee\u9898\u63cf\u8ff0<\/h5>\n<p id=\"u99d7458b\">\u901a\u8fc7Java\u53cd\u5c04\u673a\u5236&#xff0c;\u53ef\u5f3a\u5236\u8bbf\u95ee\u79c1\u6709\u6784\u9020\u65b9\u6cd5&#xff0c;\u521b\u5efa\u591a\u4e2a\u5b9e\u4f8b\u3002<\/p>\n<h5 id=\"Ose0s\">\u9632\u62a4\u65b9\u6848&#xff08;\u4ee5\u9759\u6001\u5185\u90e8\u7c7b\u4e3a\u4f8b&#xff09;<\/h5>\n<p id=\"u88b7e245\">\u5728\u6784\u9020\u65b9\u6cd5\u4e2d\u6dfb\u52a0\u5224\u65ad&#xff0c;\u82e5\u5b9e\u4f8b\u5df2\u5b58\u5728\u5219\u629b\u51fa\u5f02\u5e38&#xff1a;<\/p>\n<p>private EnvironmentalMonitor() {<br \/>\n    \/\/ \u9632\u62a4\u53cd\u5c04\u7834\u574f&#xff1a;\u82e5\u5b9e\u4f8b\u5df2\u5b58\u5728&#xff0c;\u629b\u51fa\u5f02\u5e38<br \/>\n    if (MonitorHolder.INSTANCE !&#061; null) {<br \/>\n        throw new IllegalStateException(&#034;\u5355\u4f8b\u7c7b\u7981\u6b62\u91cd\u590d\u521b\u5efa\u5b9e\u4f8b&#034;);<br \/>\n    }<br \/>\n} <\/p>\n<h4 id=\"AFUPD\">2. \u5e8f\u5217\u5316\u7834\u574f\u53ca\u9632\u62a4<\/h4>\n<h5 id=\"jdVKo\">\u95ee\u9898\u63cf\u8ff0<\/h5>\n<p id=\"u088fdcc5\">\u5b9e\u73b0Serializable\u63a5\u53e3\u7684\u5355\u4f8b\u7c7b&#xff0c;\u5e8f\u5217\u5316\u540e\u518d\u53cd\u5e8f\u5217\u5316&#xff0c;\u4f1a\u521b\u5efa\u65b0\u5b9e\u4f8b&#xff08;\u7834\u574f\u5355\u4f8b&#xff09;\u3002<\/p>\n<h5 id=\"DBbAI\">\u9632\u62a4\u65b9\u6848<\/h5>\n<p id=\"u63d06b73\">\u6dfb\u52a0readResolve()\u65b9\u6cd5&#xff0c;\u6307\u5b9a\u53cd\u5e8f\u5217\u5316\u65f6\u8fd4\u56de\u5df2\u6709\u7684\u5355\u4f8b\u5b9e\u4f8b&#xff1a;<\/p>\n<p>public class EnvironmentalMonitor implements Serializable {<br \/>\n    \/\/ \u539f\u6709\u4ee3\u7801\u4e0d\u53d8&#8230;<\/p>\n<p>    \/\/ \u53cd\u5e8f\u5217\u5316\u65f6\u8c03\u7528&#xff0c;\u8fd4\u56de\u5355\u4f8b\u5b9e\u4f8b<br \/>\n    private Object readResolve() {<br \/>\n        return MonitorHolder.INSTANCE;<br \/>\n    }<br \/>\n}<br \/>\npackage com.ao.a_singleton.demo;<\/p>\n<p>import java.io.Serializable;<\/p>\n<p>\/**<br \/>\n * \u9759\u6001\u5185\u90e8\u7c7b\u5355\u4f8b&#xff1a;\u61d2\u52a0\u8f7d&#043;\u7ebf\u7a0b\u5b89\u5168&#043;\u5b9e\u73b0\u7b80\u6d01&#xff08;\u63a8\u8350\u751f\u4ea7\u4f7f\u7528&#xff09;<br \/>\n *\/<br \/>\npublic class EnvironmentalMonitor implements Serializable {<br \/>\n    \/\/ 1. \u79c1\u6709\u6784\u9020\u65b9\u6cd5<br \/>\n    \/\/private EnvironmentalMonitor() {}<\/p>\n<p>    private EnvironmentalMonitor() {<br \/>\n        \/\/ \u9632\u62a4\u53cd\u5c04\u7834\u574f&#xff1a;\u82e5\u5b9e\u4f8b\u5df2\u5b58\u5728&#xff0c;\u629b\u51fa\u5f02\u5e38<br \/>\n        if (MonitorHolder.INSTANCE !&#061; null) {<br \/>\n            throw new IllegalStateException(&#034;\u5355\u4f8b\u7c7b\u7981\u6b62\u91cd\u590d\u521b\u5efa\u5b9e\u4f8b&#034;);<br \/>\n        }<br \/>\n    }<\/p>\n<p>    \/\/ 2. \u9759\u6001\u5185\u90e8\u7c7b&#xff1a;\u4ec5\u5f53\u88ab\u8c03\u7528\u65f6\u624d\u52a0\u8f7d<br \/>\n    private static class MonitorHolder {<br \/>\n        \/\/ \u5185\u90e8\u7c7b\u4e2d\u521d\u59cb\u5316\u5916\u90e8\u7c7b\u5b9e\u4f8b<br \/>\n        private static final EnvironmentalMonitor INSTANCE &#061; new EnvironmentalMonitor();<br \/>\n    }<\/p>\n<p>    \/\/ 3. \u5168\u5c40\u8bbf\u95ee\u65b9\u6cd5&#xff1a;\u89e6\u53d1\u5185\u90e8\u7c7b\u52a0\u8f7d<br \/>\n    public static EnvironmentalMonitor getInstance() {<br \/>\n        return MonitorHolder.INSTANCE;<br \/>\n    }<\/p>\n<p>    \/\/ \u793a\u4f8b\u4e1a\u52a1\u65b9\u6cd5<br \/>\n    public void detectAirQuality(String city) {<br \/>\n        System.out.println(&#034;\u68c0\u6d4b &#034; &#043; city &#043; &#034; \u7a7a\u6c14\u8d28\u91cf&#xff1a;\u4f18&#034;);<br \/>\n    }<\/p>\n<p>    \/\/ \u53cd\u5e8f\u5217\u5316\u65f6\u8c03\u7528&#xff0c;\u8fd4\u56de\u5355\u4f8b\u5b9e\u4f8b<br \/>\n    private Object readResolve() {<br \/>\n        return MonitorHolder.INSTANCE;<br \/>\n    }<br \/>\n}<\/p>\n<p>\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<br \/>\n\u2502                  EnvironmentalMonitor                       \u2502<br \/>\n\u2502                  implements Serializable                    \u2502<br \/>\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524<br \/>\n\u2502 &#8211; EnvironmentalMonitor()                                    \u2502<br \/>\n\u2502   \u21b3 \u53cd\u5c04\u9632\u62a4: if(instance\u5b58\u5728) throw Exception              \u2502<br \/>\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524<br \/>\n\u2502 &#043; getInstance(): EnvironmentalMonitor                       \u2502<br \/>\n\u2502 &#8211; readResolve(): Object (\u5e8f\u5217\u5316\u9632\u62a4)                        \u2502<br \/>\n\u2502 \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510 \u2502<br \/>\n\u2502 \u2502              static class MonitorHolder                 \u2502 \u2502<br \/>\n\u2502 \u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524 \u2502<br \/>\n\u2502 \u2502 &#8211; INSTANCE: EnvironmentalMonitor                        \u2502 \u2502<br \/>\n\u2502 \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518 \u2502<br \/>\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518 <\/p>\n<h3 id=\"liASS\">\u56db\u30016\u79cd\u5b9e\u73b0\u65b9\u5f0f\u5bf9\u6bd4\u603b\u7ed3<\/h3>\n<table id=\"ba6DW\">\n<tbody>\n<tr>\n<td>\n<p id=\"u4cecb3ae\">\u5b9e\u73b0\u65b9\u5f0f<\/p>\n<\/td>\n<td>\n<p id=\"u66e61ab5\">\u7ebf\u7a0b\u5b89\u5168<\/p>\n<\/td>\n<td>\n<p id=\"ue14d0093\">\u61d2\u52a0\u8f7d<\/p>\n<\/td>\n<td>\n<p id=\"u2be3c572\">\u9632\u53cd\u5c04<\/p>\n<\/td>\n<td>\n<p id=\"u7f517a9c\">\u9632\u5e8f\u5217\u5316<\/p>\n<\/td>\n<td>\n<p id=\"u5e0e7b32\">\u9002\u7528\u573a\u666f<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"u8a16ae4b\">\u997f\u6c49\u5f0f<\/p>\n<\/td>\n<td>\n<p id=\"ua2373117\">\u662f<\/p>\n<\/td>\n<td>\n<p id=\"u95fd6a3d\">\u5426<\/p>\n<\/td>\n<td>\n<p id=\"udddc717e\">\u5426<\/p>\n<\/td>\n<td>\n<p id=\"u9401ea3b\">\u5426<\/p>\n<\/td>\n<td>\n<p id=\"u89f30973\">\u5b9e\u4f8b\u4f53\u79ef\u5c0f\u3001\u542f\u52a8\u5fc5\u7528<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"uba67c722\">\u61d2\u6c49\u5f0f&#xff08;\u65e0\u9501&#xff09;<\/p>\n<\/td>\n<td>\n<p id=\"u5740b229\">\u5426<\/p>\n<\/td>\n<td>\n<p id=\"uaf4aa29a\">\u662f<\/p>\n<\/td>\n<td>\n<p id=\"u6484809b\">\u5426<\/p>\n<\/td>\n<td>\n<p id=\"u70f2d3c0\">\u5426<\/p>\n<\/td>\n<td>\n<p id=\"ubc6fef08\">\u5355\u7ebf\u7a0b\u6d4b\u8bd5\u573a\u666f<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"u1410469a\">\u61d2\u6c49\u5f0f&#xff08;\u540c\u6b65\u65b9\u6cd5&#xff09;<\/p>\n<\/td>\n<td>\n<p id=\"ue9a3dec9\">\u662f<\/p>\n<\/td>\n<td>\n<p id=\"u8429fb4e\">\u662f<\/p>\n<\/td>\n<td>\n<p id=\"uf1ac6c87\">\u5426<\/p>\n<\/td>\n<td>\n<p id=\"u02ad93da\">\u5426<\/p>\n<\/td>\n<td>\n<p id=\"ud36fb80f\">\u4f4e\u5e76\u53d1\u3001\u5bf9\u6027\u80fd\u65e0\u8981\u6c42<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"uca709664\">\u53cc\u91cd\u6821\u9a8c\u9501<\/p>\n<\/td>\n<td>\n<p id=\"uf9c5cb67\">\u662f<\/p>\n<\/td>\n<td>\n<p id=\"uada0b770\">\u662f<\/p>\n<\/td>\n<td>\n<p id=\"u2dcfec9e\">\u5426<\/p>\n<\/td>\n<td>\n<p id=\"u5ac0d079\">\u5426<\/p>\n<\/td>\n<td>\n<p id=\"u8c33d045\">\u9ad8\u5e76\u53d1\u751f\u4ea7\u73af\u5883<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"u1d40de3d\">\u9759\u6001\u5185\u90e8\u7c7b<\/p>\n<\/td>\n<td>\n<p id=\"u55194681\">\u662f<\/p>\n<\/td>\n<td>\n<p id=\"u6ce97811\">\u662f<\/p>\n<\/td>\n<td>\n<p id=\"u02328c9e\">\u5426<\/p>\n<\/td>\n<td>\n<p id=\"ub45eef7f\">\u5426<\/p>\n<\/td>\n<td>\n<p id=\"u9f080540\">\u5927\u591a\u6570\u751f\u4ea7\u73af\u5883&#xff08;\u63a8\u8350&#xff09;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"u6a27954d\">\u679a\u4e3e\u5355\u4f8b<\/p>\n<\/td>\n<td>\n<p id=\"ud0933add\">\u662f<\/p>\n<\/td>\n<td>\n<p id=\"u29b82668\">\u5426<\/p>\n<\/td>\n<td>\n<p id=\"u984134a4\">\u662f<\/p>\n<\/td>\n<td>\n<p id=\"u1d170dbd\">\u662f<\/p>\n<\/td>\n<td>\n<p id=\"ufa59a309\">\u9ad8\u7a33\u5b9a\u6027\u6838\u5fc3\u4e1a\u52a1&#xff08;\u63a8\u8350&#xff09;<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3 id=\"C8zjU\">\u4e94\u3001\u4f7f\u7528\u5efa\u8bae<\/h3>\n<li id=\"u8f9ba326\">\u4f18\u5148\u9009\u62e9\u9759\u6001\u5185\u90e8\u7c7b\u6216\u679a\u4e3e\u5355\u4f8b&#xff1a;\u9759\u6001\u5185\u90e8\u7c7b\u517c\u987e\u61d2\u52a0\u8f7d\u4e0e\u6027\u80fd&#xff0c;\u679a\u4e3e\u5355\u4f8b\u517c\u987e\u7a33\u5b9a\u6027\u4e0e\u7b80\u6d01\u6027&#xff1b;<\/li>\n<li id=\"ue89837ed\">\u907f\u514d\u4f7f\u7528\u61d2\u6c49\u5f0f&#xff08;\u65e0\u9501\/\u540c\u6b65\u65b9\u6cd5&#xff09;&#xff1a;\u65e0\u9501\u7ebf\u7a0b\u4e0d\u5b89\u5168&#xff0c;\u540c\u6b65\u65b9\u6cd5\u6027\u80fd\u5dee&#xff1b;<\/li>\n<li id=\"ub1b8d3cb\">\u997f\u6c49\u5f0f\u4ec5\u7528\u4e8e\u5c0f\u5b9e\u4f8b&#xff1a;\u907f\u514d\u5927\u5b9e\u4f8b\u9884\u52a0\u8f7d\u9020\u6210\u5185\u5b58\u6d6a\u8d39&#xff1b;<\/li>\n<li id=\"u33652cc7\">\u6838\u5fc3\u4e1a\u52a1\u7528\u679a\u4e3e\u5355\u4f8b&#xff1a;\u9632\u53cd\u5c04\u3001\u9632\u5e8f\u5217\u5316&#xff0c;\u7a33\u5b9a\u6027\u6700\u9ad8&#xff1b;<\/li>\n<li id=\"ud1e1474d\">\u907f\u514d\u6ee5\u7528\u5355\u4f8b&#xff1a;\u4ec5\u7528\u4e8e\u9700\u552f\u4e00\u5b9e\u4f8b\u7684\u573a\u666f&#xff0c;\u5426\u5219\u4f1a\u5bfc\u81f4\u4ee3\u7801\u8026\u5408\u5ea6\u5347\u9ad8\u3002<\/li>\n<p id=\"u1a587162\">\n","protected":false},"excerpt":{"rendered":"<p>\u514d\u8d39\u7248Java\u5b66\u4e60\u7b14\u8bb0&#xff08;38w\u5b57&#xff09;\u94fe\u63a5&#xff1a;https:\/\/www.yuque.com\/aoyouaoyou\/sgcqr8 \u514d\u8d39\u7248Java\u9762\u8bd5\u9898&#xff08;28w\u5b57&#xff09;\u94fe\u63a5&#xff1a;https:\/\/www.yuque.com\/aoyouaoyou\/wh3hto \u5b8c\u6574\u7248\u53ef\u5728\u5c0f\u7ea2\u4e66\u641c\u7d22&#xff1a;\u9068\u6e38qk0 \u5355\u4f8b\u6a21\u5f0f\u662f\u521b\u5efa\u578b\u8bbe\u8ba1\u6a21\u5f0f\u4e2d\u6700\u5e38\u7528\u7684\u4e00\u79cd&#xff0c;\u6838\u5fc3\u662f\u4fdd\u8bc1\u67d0\u4e2a\u7c7b\u5728\u7a0b\u5e8f\u8fd0\u884c\u671f\u95f4\u4ec5\u6709\u4e00\u4e2a\u5b9e\u4f8b&amp;#xff0c<\/p>\n","protected":false},"author":2,"featured_media":71582,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[99,190],"topic":[],"class_list":["post-71591","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-java","tag-190"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u5355\u4f8b\u6a21\u5f0f\u7b14\u8bb0 - \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\/71591.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u5355\u4f8b\u6a21\u5f0f\u7b14\u8bb0 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u514d\u8d39\u7248Java\u5b66\u4e60\u7b14\u8bb0&#xff08;38w\u5b57&#xff09;\u94fe\u63a5&#xff1a;https:\/\/www.yuque.com\/aoyouaoyou\/sgcqr8 \u514d\u8d39\u7248Java\u9762\u8bd5\u9898&#xff08;28w\u5b57&#xff09;\u94fe\u63a5&#xff1a;https:\/\/www.yuque.com\/aoyouaoyou\/wh3hto \u5b8c\u6574\u7248\u53ef\u5728\u5c0f\u7ea2\u4e66\u641c\u7d22&#xff1a;\u9068\u6e38qk0 \u5355\u4f8b\u6a21\u5f0f\u662f\u521b\u5efa\u578b\u8bbe\u8ba1\u6a21\u5f0f\u4e2d\u6700\u5e38\u7528\u7684\u4e00\u79cd&#xff0c;\u6838\u5fc3\u662f\u4fdd\u8bc1\u67d0\u4e2a\u7c7b\u5728\u7a0b\u5e8f\u8fd0\u884c\u671f\u95f4\u4ec5\u6709\u4e00\u4e2a\u5b9e\u4f8b&amp;#xff0c\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/71591.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-02-03T15:04:58+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260203150456-69820e98229ce.png\" \/>\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=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/71591.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/71591.html\",\"name\":\"\u5355\u4f8b\u6a21\u5f0f\u7b14\u8bb0 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-02-03T15:04:58+00:00\",\"dateModified\":\"2026-02-03T15:04:58+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/71591.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/71591.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/71591.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u5355\u4f8b\u6a21\u5f0f\u7b14\u8bb0\"}]},{\"@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":"\u5355\u4f8b\u6a21\u5f0f\u7b14\u8bb0 - \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\/71591.html","og_locale":"zh_CN","og_type":"article","og_title":"\u5355\u4f8b\u6a21\u5f0f\u7b14\u8bb0 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u514d\u8d39\u7248Java\u5b66\u4e60\u7b14\u8bb0&#xff08;38w\u5b57&#xff09;\u94fe\u63a5&#xff1a;https:\/\/www.yuque.com\/aoyouaoyou\/sgcqr8 \u514d\u8d39\u7248Java\u9762\u8bd5\u9898&#xff08;28w\u5b57&#xff09;\u94fe\u63a5&#xff1a;https:\/\/www.yuque.com\/aoyouaoyou\/wh3hto \u5b8c\u6574\u7248\u53ef\u5728\u5c0f\u7ea2\u4e66\u641c\u7d22&#xff1a;\u9068\u6e38qk0 \u5355\u4f8b\u6a21\u5f0f\u662f\u521b\u5efa\u578b\u8bbe\u8ba1\u6a21\u5f0f\u4e2d\u6700\u5e38\u7528\u7684\u4e00\u79cd&#xff0c;\u6838\u5fc3\u662f\u4fdd\u8bc1\u67d0\u4e2a\u7c7b\u5728\u7a0b\u5e8f\u8fd0\u884c\u671f\u95f4\u4ec5\u6709\u4e00\u4e2a\u5b9e\u4f8b&amp;#xff0c","og_url":"https:\/\/www.wsisp.com\/helps\/71591.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-02-03T15:04:58+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260203150456-69820e98229ce.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/71591.html","url":"https:\/\/www.wsisp.com\/helps\/71591.html","name":"\u5355\u4f8b\u6a21\u5f0f\u7b14\u8bb0 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-02-03T15:04:58+00:00","dateModified":"2026-02-03T15:04:58+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/71591.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/71591.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/71591.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u5355\u4f8b\u6a21\u5f0f\u7b14\u8bb0"}]},{"@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\/71591","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=71591"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/71591\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/71582"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=71591"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=71591"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=71591"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=71591"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}