{"id":106371,"date":"2026-09-17T09:48:35","date_gmt":"2026-09-17T01:48:35","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/106371.html"},"modified":"2026-09-17T09:48:35","modified_gmt":"2026-09-17T01:48:35","slug":"%e4%b8%ba%e4%bb%80%e4%b9%88%e4%bd%a0%e5%86%99%e7%9a%84-java-%e4%bb%a3%e7%a0%81%e7%9c%8b%e7%9d%80%e9%9d%a2%e5%90%91%e5%af%b9%e8%b1%a1%e3%80%81%e5%ae%9e%e9%99%85%e6%98%af%e9%9d%a2%e5%90%91","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/106371.html","title":{"rendered":"\u4e3a\u4ec0\u4e48\u4f60\u5199\u7684 Java \u4ee3\u7801\u201c\u770b\u7740\u9762\u5411\u5bf9\u8c61\u3001\u5b9e\u9645\u662f\u9762\u5411\u8fc7\u7a0b\u201c\uff1f"},"content":{"rendered":"<p>\u300c\u8bbe\u8ba1\u6a21\u5f0f\u4e0e\u8303\u5f0f\u300d\u7cfb\u5217 Day02<\/p>\n<h3>\u5199\u5728\u524d\u9762<\/h3>\n<p>\u7528 Java \u5199\u4ee3\u7801 \u2260 \u5199\u7684\u662f\u9762\u5411\u5bf9\u8c61\u98ce\u683c\u4ee3\u7801\u3002Utils \u6ee1\u5929\u98de\u3001getter\/setter \u65e0\u8111\u751f\u6210\u3001\u8d2b\u8840\u6a21\u578b\u2014\u2014\u8fd9\u4e9b\u90fd\u662f\u62ab\u7740\u9762\u5411\u5bf9\u8c61\u5916\u76ae\u7684\u9762\u5411\u8fc7\u7a0b\u4ee3\u7801\u3002<\/p>\n<p>\u8fd9\u7bc7\u5148\u6253\u5730\u57fa&#xff1a;OOP \u662f\u4ec0\u4e48\u3001\u56db\u5927\u7279\u6027\u5404\u89e3\u51b3\u4ec0\u4e48\u95ee\u9898&#xff0c;\u518d\u770b\u51e0\u4e2a&#034;\u770b\u7740\u9762\u5411\u5bf9\u8c61\u3001\u5b9e\u9645\u9762\u5411\u8fc7\u7a0b&#034;\u7684\u53cd\u4f8b\u3002<\/p>\n<hr \/>\n<h3>\u4e00\u3001\u662f\u4ec0\u4e48<\/h3>\n<p>\u9762\u5411\u5bf9\u8c61\u7f16\u7a0b&#xff08;OOP&#xff09;&#xff1a;\u4ee5\u7c7b\/\u5bf9\u8c61\u4e3a\u57fa\u672c\u5355\u5143&#xff0c;\u5c01\u88c5\u3001\u62bd\u8c61\u3001\u7ee7\u627f\u3001\u591a\u6001\u4e3a\u57fa\u77f3\u7684\u7f16\u7a0b\u8303\u5f0f\u3002\u9762\u5411\u5bf9\u8c61\u7f16\u7a0b\u8bed\u8a00&#xff0c;\u5c31\u662f\u63d0\u4f9b\u4e86\u73b0\u6210\u8bed\u6cd5\u652f\u6301\u8fd9\u56db\u5927\u7279\u6027\u7684\u8bed\u8a00\u2014\u2014\u4f46\u7528\u9762\u5411\u5bf9\u8c61\u8bed\u8a00\u5199\u4ee3\u7801\u4e0d\u7b49\u4e8e\u5199\u7684\u5c31\u662f\u9762\u5411\u5bf9\u8c61\u98ce\u683c&#xff0c;\u8fd9\u6b63\u662f\u672c\u7bc7\u8981\u8bb2\u7684\u91cd\u70b9\u3002<\/p>\n<p>\u843d\u5730\u8fc7\u7a0b\u5206\u4e09\u6b65&#xff1a;\u9762\u5411\u5bf9\u8c61\u5206\u6790&#xff08;OOA&#xff0c;\u641e\u6e05\u695a\u505a\u4ec0\u4e48&#xff09;\u2192 \u9762\u5411\u5bf9\u8c61\u8bbe\u8ba1&#xff08;OOD&#xff0c;\u641e\u6e05\u695a\u600e\u4e48\u505a&#xff0c;\u4ea7\u51fa\u7c7b\u7684\u62c6\u5206\u3001\u5c5e\u6027\u65b9\u6cd5\u3001\u7c7b\u95f4\u5173\u7cfb&#xff0c;\u5e38\u7528 UML \u8868\u8fbe&#xff09;\u2192 \u9762\u5411\u5bf9\u8c61\u7f16\u7a0b&#xff08;\u628a\u8bbe\u8ba1\u7ffb\u8bd1\u6210\u4ee3\u7801&#xff09;\u3002<\/p>\n<hr \/>\n<h3>\u4e8c\u3001\u4e3a\u4ec0\u4e48&#xff1a;\u56db\u5927\u7279\u6027\u5404\u89e3\u51b3\u4ec0\u4e48\u95ee\u9898<\/h3>\n<table>\n<tr>\u7279\u6027\u89e3\u51b3\u7684\u95ee\u9898\u600e\u4e48\u5b9e\u73b0\u4ef7\u503c<\/tr>\n<tbody>\n<tr>\n<td>\u5c01\u88c5<\/td>\n<td>\u9690\u85cf\u6570\u636e<\/td>\n<td>public\/protected\/private \u8bbf\u95ee\u63a7\u5236<\/td>\n<td>\u6570\u636e\u4e0d\u88ab\u968f\u610f\u6539&#xff1b;\u63a5\u53e3\u7b80\u5355\u6613\u7528<\/td>\n<\/tr>\n<tr>\n<td>\u62bd\u8c61<\/td>\n<td>\u9690\u85cf\u5b9e\u73b0<\/td>\n<td>\u63a5\u53e3 \/ \u62bd\u8c61\u7c7b&#xff08;\u4e0d\u9700\u8981\u4e13\u95e8\u8bed\u6cd5&#xff09;<\/td>\n<td>\u6539\u5b9e\u73b0\u4e0d\u5f71\u54cd\u8c03\u7528\u65b9&#xff1b;\u8fc7\u6ee4\u590d\u6742\u7ec6\u8282<\/td>\n<\/tr>\n<tr>\n<td>\u7ee7\u627f<\/td>\n<td>\u4ee3\u7801\u590d\u7528<\/td>\n<td>\u5355\u7ee7\u627f \/ \u591a\u7ee7\u627f\u8bed\u6cd5<\/td>\n<td>\u8868\u8fbe\u7c7b\u4e4b\u95f4\u7684 is-a \u5173\u7cfb<\/td>\n<\/tr>\n<tr>\n<td>\u591a\u6001<\/td>\n<td>\u5b50\u7c7b\u66ff\u6362\u7236\u7c7b<\/td>\n<td>\u7ee7\u627f\u91cd\u5199 \/ \u63a5\u53e3\u5b9e\u73b0 \/ duck-typing<\/td>\n<td>\u4e00\u5927\u6279\u8bbe\u8ba1\u6a21\u5f0f\u7684\u5b9e\u73b0\u57fa\u7840<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u591a\u6001\u5728 Java \u91cc\u53ea\u6709\u4e24\u6761\u5b9e\u73b0\u8def\u5f84&#xff1a;\u7ee7\u627f &#043; \u91cd\u5199&#xff0c;\u6216\u8005\u63a5\u53e3\u5b9e\u73b0&#xff0c;\u7236\u5b50\u7c7b\/\u5b9e\u73b0\u7c7b\u5173\u7cfb\u662f\u5fc5\u987b\u7684\u3002Python\u3001Ruby \u8fd9\u7c7b\u52a8\u6001\u8bed\u8a00\u8fd8\u591a\u4e00\u6761 duck-typing\u2014\u2014\u4e0d\u8981\u6c42\u4efb\u4f55\u7ee7\u627f\u6216\u63a5\u53e3\u5173\u7cfb&#xff0c;\u53ea\u8981\u65b9\u6cd5\u540d\u76f8\u540c\u5c31\u80fd\u5b9e\u73b0\u591a\u6001&#xff0c;\u9760\u7684\u662f\u8fd0\u884c\u65f6\u52a8\u6001\u67e5\u627e\u3002Java \u505a\u4e0d\u4e86\u8fd9\u79cd&#034;\u957f\u5f97\u50cf\u9e2d\u5b50\u5c31\u662f\u9e2d\u5b50&#034;\u5f0f\u7684\u591a\u6001\u3002<\/p>\n<p>\u9762\u5411\u5bf9\u8c61\u548c\u9762\u5411\u8fc7\u7a0b\u4e5f\u6ca1\u6709\u4e25\u683c\u7684\u5b98\u65b9\u5b9a\u4e49&#xff0c;\u7406\u89e3\u5b83\u4eec\u6700\u597d\u7684\u65b9\u5f0f\u662f\u4e92\u76f8\u5bf9\u7167&#xff1a;\u9762\u5411\u8fc7\u7a0b\u4ee5\u8fc7\u7a0b\/\u65b9\u6cd5\u4e3a\u57fa\u672c\u5355\u5143&#xff0c;\u6570\u636e\u548c\u65b9\u6cd5\u5206\u79bb&#xff0c;\u9002\u5408\u5355\u4e00\u4e3b\u7ebf\u7684\u811a\u672c\u4efb\u52a1&#xff1b;\u9762\u5411\u5bf9\u8c61\u4ee5\u7c7b\u4e3a\u57fa\u672c\u5355\u5143&#xff0c;\u6570\u636e\u548c\u65b9\u6cd5\u7ed1\u5b9a&#xff0c;\u66f4\u9002\u5408\u7f51\u72b6\u4ea4\u4e92\u7684\u590d\u6742\u7cfb\u7edf\u3002\u4e24\u8005\u4e0d\u662f\u4e8c\u9009\u4e00\u7684\u5bf9\u7acb\u5173\u7cfb\u2014\u2014\u9762\u5411\u8fc7\u7a0b\u53ef\u4ee5\u770b\u4f5c\u9762\u5411\u5bf9\u8c61\u7684\u5730\u57fa&#xff0c;\u6bcf\u4e2a\u65b9\u6cd5\u5185\u90e8\u7684\u5b9e\u73b0\u903b\u8f91&#xff0c;\u672c\u8eab\u5c31\u662f\u4e00\u6bb5\u9762\u5411\u8fc7\u7a0b\u98ce\u683c\u7684\u4ee3\u7801\u3002<\/p>\n<hr \/>\n<h3>\u4e09\u3001\u600e\u4e48\u7528&#xff1a;\u4e09\u4e2a&#034;\u770b\u7740 OOP\u3001\u5b9e\u9645\u9762\u5411\u8fc7\u7a0b&#034;\u7684\u53cd\u4f8b<\/h3>\n<h4>\u53cd\u4f8b\u4e00&#xff1a;\u65e0\u8111\u751f\u6210 getter \/ setter<\/h4>\n<p>\u5c01\u88c5\u8981\u6c42&#034;\u5916\u90e8\u53ea\u80fd\u901a\u8fc7\u6709\u9650\u63a5\u53e3\u8bbf\u95ee\u6570\u636e&#034;&#xff0c;IDE \u4e00\u952e\u751f\u6210\u5168\u5957 setter&#xff0c;\u7b49\u4e8e\u628a\u5185\u90e8\u6570\u636e\u5168\u90e8\u66b4\u9732&#xff0c;\u76f4\u63a5\u8fdd\u80cc\u5c01\u88c5\u3002<\/p>\n<p>\u66f4\u9690\u853d\u7684\u5751\u2014\u2014\u5bb9\u5668\u7c7b\u578b\u5c5e\u6027&#xff0c;\u53ea\u7ed9 getter \u4e5f\u6321\u4e0d\u4f4f&#xff1a;<\/p>\n<p><span class=\"token keyword\">public<\/span> <span class=\"token keyword\">class<\/span> <span class=\"token class-name\">Order<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">private<\/span> <span class=\"token class-name\">List<\/span><span class=\"token generics\"><span class=\"token punctuation\">&lt;<\/span><span class=\"token class-name\">Item<\/span><span class=\"token punctuation\">&gt;<\/span><\/span> items<span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">public<\/span> <span class=\"token class-name\">List<\/span><span class=\"token generics\"><span class=\"token punctuation\">&lt;<\/span><span class=\"token class-name\">Item<\/span><span class=\"token punctuation\">&gt;<\/span><\/span> <span class=\"token function\">getItems<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span> <span class=\"token keyword\">return<\/span> items<span class=\"token punctuation\">;<\/span> <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>order<span class=\"token punctuation\">.<\/span><span class=\"token function\">getItems<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">clear<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u6ca1\u8c03\u7528\u4efb\u4f55 setter&#xff0c;\u5185\u90e8\u6570\u636e\u7167\u6837\u88ab\u6e05\u7a7a<\/span><\/p>\n<p>\u7f13\u89e3\u65b9\u6cd5&#xff1a;<\/p>\n<p><span class=\"token keyword\">public<\/span> <span class=\"token class-name\">List<\/span><span class=\"token generics\"><span class=\"token punctuation\">&lt;<\/span><span class=\"token class-name\">Item<\/span><span class=\"token punctuation\">&gt;<\/span><\/span> <span class=\"token function\">getItems<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> <span class=\"token class-name\">Collections<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">unmodifiableList<\/span><span class=\"token punctuation\">(<\/span>items<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token comment\">\/\/ order.getItems().clear() \u4f1a\u76f4\u63a5\u629b UnsupportedOperationException<\/span><\/p>\n<p>\u5c40\u9650&#xff1a;\u8fd9\u53ea\u6321\u4f4f\u4e86&#034;\u6539\u5bb9\u5668\u7ed3\u6784&#034;&#xff0c;\u5bb9\u5668\u91cc\u6bcf\u4e2a Item \u5bf9\u8c61\u81ea\u8eab\u7684\u5b57\u6bb5\u4f9d\u7136\u80fd\u88ab\u5916\u90e8\u6539&#xff08;getItems().get(0).setPrice(0) \u7167\u6837\u751f\u6548&#xff09;\u3002<\/p>\n<h4>\u53cd\u4f8b\u4e8c&#xff1a;\u6ee5\u7528\u5168\u5c40\u53d8\u91cf \/ \u5168\u5c40\u65b9\u6cd5<\/h4>\n<p>\u5355\u4f8b\u5bf9\u8c61\u3001\u9759\u6001\u6210\u5458\u53d8\u91cf\u3001\u5e38\u91cf &#061; \u5168\u5c40\u53d8\u91cf&#xff1b;\u9759\u6001\u65b9\u6cd5 &#061; \u5168\u5c40\u65b9\u6cd5&#xff0c;\u6570\u636e\u548c\u65b9\u6cd5\u5206\u79bb&#xff0c;\u5178\u578b\u9762\u5411\u8fc7\u7a0b\u3002<\/p>\n<p>\u5927\u800c\u5168\u7684 Constants \u7c7b\u662f\u91cd\u707e\u533a&#xff1a;\u6539\u4e00\u4e2a\u5e38\u91cf\u8981\u5728\u5de8\u5927\u6587\u4ef6\u91cc\u7ffb\u627e&#xff0c;\u53ef\u7ef4\u62a4\u6027\u5dee&#xff1b;\u4efb\u4f55\u5f15\u7528\u90fd\u4f1a\u56e0\u4e3a\u8fd9\u4e00\u4e2a\u7c7b\u7684\u6539\u52a8\u88ab\u7275\u8fde\u91cd\u65b0\u7f16\u8bd1&#xff0c;\u62d6\u6162\u6784\u5efa&#xff1b;\u60f3\u590d\u7528\u5176\u4e2d\u51e0\u4e2a\u5e38\u91cf&#xff0c;\u5f97\u628a\u6574\u4e2a\u5927\u7c7b\u4e00\u8d77\u642c\u8d70&#xff0c;\u590d\u7528\u6027\u4e5f\u5dee\u3002\u6539\u8fdb\u601d\u8def\u5f88\u76f4\u63a5&#xff1a;\u8981\u4e48\u6309\u529f\u80fd\u62c6\u5206\u6210 MysqlConstants\u3001RedisConstants \u8fd9\u7c7b\u5c0f\u7c7b&#xff0c;\u8981\u4e48\u5e72\u8106\u4e0d\u5355\u5efa Constants \u7c7b&#xff0c;\u8c01\u7528\u5c31\u8fd1\u5b9a\u4e49\u5728\u8c01\u7684\u7c7b\u91cc\u3002<\/p>\n<p>Utils \u7c7b\u540c\u7406&#xff1a;\u4e24\u4e2a\u65e0\u7ee7\u627f\u5173\u7cfb\u7684\u7c7b\u8981\u590d\u7528\u540c\u4e00\u6bb5\u903b\u8f91&#xff0c;\u5efa\u4e00\u4e2a\u53ea\u6709\u9759\u6001\u65b9\u6cd5\u7684 Utils \u7c7b\u662f\u52a1\u5b9e\u9009\u62e9&#xff0c;\u672c\u8d28\u9762\u5411\u8fc7\u7a0b&#xff0c;\u4f46\u4e0d\u7b97\u6ee5\u7528\u2014\u2014\u80fd\u5f52\u5230\u5177\u4f53\u4e1a\u52a1\u7c7b\u7684\u903b\u8f91&#xff0c;\u4f18\u5148\u5f52\u5230\u90a3\u4e2a\u7c7b&#xff0c;\u4e0d\u8981\u4e60\u60ef\u6027\u4e22\u8fdb Utils\u3002<\/p>\n<h4>\u53cd\u4f8b\u4e09&#xff1a;\u6570\u636e\u548c\u65b9\u6cd5\u5206\u79bb\u7684\u8d2b\u8840\u6a21\u578b<\/h4>\n<p>MVC \u4e09\u5c42\u67b6\u6784\u4e0b&#xff0c;Controller\/Service\/DAO \u5168\u662f\u65b9\u6cd5&#xff0c;POJO \u53ea\u6709 getter\/setter \u6ca1\u6709\u4e1a\u52a1\u903b\u8f91\u2014\u2014\u8fd9\u662f\u76ee\u524d Web \u9879\u76ee\u7684\u4e3b\u6d41\u5f00\u53d1\u65b9\u5f0f&#xff0c;\u5374\u4e25\u683c\u8fdd\u80cc\u9762\u5411\u5bf9\u8c61\u7f16\u7801\u98ce\u683c\u3002\u80cc\u540e\u7684\u53d6\u820d\u6743\u8861&#xff0c;\u7559\u5230\u540e\u9762\u6a21\u5757\u4e13\u95e8\u5c55\u5f00\u3002<\/p>\n<h4>\u4e3a\u4ec0\u4e48\u9762\u5411\u5bf9\u8c61\u4ee3\u7801\u603b\u662f\u4e0d\u81ea\u89c9\u5199\u6210\u9762\u5411\u8fc7\u7a0b<\/h4>\n<p>\u4eba\u7684\u9ed8\u8ba4\u601d\u7ef4\u662f\u6d41\u7a0b\u5316\u7684&#xff08;\u5148\u505a A \u518d\u505a B&#xff09;&#xff0c;\u8fd9\u548c\u9762\u5411\u8fc7\u7a0b\u5929\u7136\u5951\u5408&#xff1b;\u9762\u5411\u5bf9\u8c61\u8981\u6c42\u53cd\u8fc7\u6765\u60f3\u2014\u2014\u5148\u62c6\u7c7b\u3001\u8bbe\u8ba1\u4ea4\u4e92\u3001\u518d\u7ec4\u88c5\u6d41\u7a0b&#xff0c;\u5c5e\u4e8e\u523b\u610f\u8bad\u7ec3\u51fa\u6765\u7684\u80fd\u529b&#xff0c;\u9000\u5316\u56de\u9762\u5411\u8fc7\u7a0b\u5f88\u6b63\u5e38&#xff0c;\u4e0d\u7528\u592a\u81ea\u8d23\u3002<\/p>\n<hr \/>\n<h3>\u56db\u3001\u9762\u8bd5\u8ffd\u95ee<\/h3>\n<p>Q1&#xff1a;duck-typing \u662f\u4ec0\u4e48&#xff0c;Java \u80fd\u4e0d\u80fd\u5b9e\u73b0&#xff1f;<\/p>\n<p>\u65b9\u6cd5\u540d\u76f8\u540c\u5373\u53ef\u5b9e\u73b0\u591a\u6001&#xff0c;\u4e0d\u8981\u6c42\u7ee7\u627f\u6216\u63a5\u53e3\u5173\u7cfb&#xff0c;\u52a8\u6001\u8bed\u8a00\u7279\u6709\u3002Java \u662f\u9759\u6001\u8bed\u8a00&#xff0c;\u591a\u6001\u53ea\u80fd\u9760\u7ee7\u627f\u91cd\u5199\u6216\u63a5\u53e3\u5b9e\u73b0\u8fd9\u4e24\u6761\u8def\u3002<\/p>\n<p>Q2&#xff1a;Utils \u7c7b\u8981\u4e0d\u8981\u5b8c\u5168\u7981\u7528&#xff1f;<\/p>\n<p>\u4e0d\u7528\u3002\u4e24\u4e2a\u65e0\u5173\u8054\u7684\u7c7b\u590d\u7528\u540c\u4e00\u903b\u8f91\u65f6\u662f\u52a1\u5b9e\u65b9\u6848\u3002\u8981\u907f\u514d\u7684\u662f\u4e0d\u5047\u601d\u7d22\u5730\u628a\u4ec0\u4e48\u903b\u8f91\u90fd\u5f80\u91cc\u585e\u2014\u2014\u80fd\u5f52\u5230\u5177\u4f53\u4e1a\u52a1\u7c7b\u7684&#xff0c;\u4f18\u5148\u5f52\u90a3\u4e2a\u7c7b\u3002<\/p>\n<p>Q3&#xff1a;\u53ea\u63d0\u4f9b getter\u3001\u4e0d\u63d0\u4f9b setter&#xff0c;\u7b49\u4e8e\u5c01\u88c5\u5230\u4f4d\u4e86\u5417&#xff1f;<\/p>\n<p>\u770b\u7c7b\u578b\u3002\u57fa\u672c\u7c7b\u578b\/\u4e0d\u53ef\u53d8\u5bf9\u8c61\u53ef\u4ee5&#xff1b;\u96c6\u5408\u7c7b\u578b\u4e0d\u884c\u2014\u2014getter \u8fd4\u56de\u7684\u662f\u5185\u90e8\u5f15\u7528&#xff0c;\u8c03\u7528\u65b9\u80fd\u76f4\u63a5 clear()\/add()\u3002\u9700\u8981 Collections.unmodifiableXxx() \u5305\u4e00\u5c42&#xff0c;\u4e14\u8fd9\u53ea\u6321\u4f4f\u4e86\u5bb9\u5668\u7ed3\u6784&#xff0c;\u6321\u4e0d\u4f4f\u5bb9\u5668\u5185\u5143\u7d20\u81ea\u8eab\u88ab\u6539\u3002<\/p>\n<hr \/>\n<h3>\u4e0b\u4e00\u7bc7\u9884\u544a<\/h3>\n<p>Day03&#xff1a;\u63a5\u53e3 vs \u62bd\u8c61\u7c7b\u600e\u4e48\u9009\u3001\u201c\u57fa\u4e8e\u63a5\u53e3\u800c\u975e\u5b9e\u73b0\u7f16\u7a0b&#034;\u600e\u4e48\u843d\u5730\u3001\u4e3a\u4ec0\u4e48\u90fd\u8bf4&#034;\u591a\u7528\u7ec4\u5408\u5c11\u7528\u7ee7\u627f\u201d&#xff0c;\u4ee5\u53ca\u8d2b\u8840\u6a21\u578b\u548c\u5145\u8840\u6a21\u578b\u8fd9\u9053\u9009\u62e9\u9898\u80cc\u540e\u7684\u53d6\u820d\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u300c\u8bbe\u8ba1\u6a21\u5f0f\u4e0e\u8303\u5f0f\u300d\u7cfb\u5217 Day02\u5199\u5728\u524d\u9762<br \/>\n\u7528 Java \u5199\u4ee3\u7801 \u2260 \u5199\u7684\u662f\u9762\u5411\u5bf9\u8c61\u98ce\u683c\u4ee3\u7801\u3002Utils \u6ee1\u5929\u98de\u3001getter\/setter \u65e0\u8111\u751f\u6210\u3001\u8d2b\u8840\u6a21\u578b\u2014\u2014\u8fd9\u4e9b\u90fd\u662f\u62ab\u7740\u9762\u5411\u5bf9\u8c61\u5916\u76ae\u7684\u9762\u5411\u8fc7\u7a0b\u4ee3\u7801\u3002<br \/>\n\u8fd9\u7bc7\u5148\u6253\u5730\u57fa&#xff1a;OOP \u662f\u4ec0\u4e48\u3001\u56db\u5927\u7279\u6027\u5404\u89e3\u51b3\u4ec0\u4e48\u95ee\u9898&#xff0c;\u518d\u770b\u51e0\u4e2a\\&#8221;\u770b\u7740\u9762\u5411\u5bf9\u8c61\u3001\u5b9e\u9645\u9762\u5411\u8fc7\u7a0b\\&#8221;\u7684\u53cd\u4f8b\u3002\u4e00\u3001\u662f\u4ec0\u4e48<br \/>\n\u9762\u5411\u5bf9\u8c61\u7f16\u7a0b&#xff08;OOP&#xff09;&#xff1a;\u4ee5\u7c7b\/\u5bf9\u8c61\u4e3a\u57fa\u672c\u5355\u5143&#xff0c;\u5c01\u88c5\u3001\u62bd\u8c61\u3001\u7ee7\u627f\u3001\u591a\u6001\u4e3a\u57fa\u77f3\u7684\u7f16<\/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":[2874,2122],"topic":[],"class_list":["post-106371","post","type-post","status-publish","format-standard","hentry","category-server","tag-2874","tag-2122"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u4e3a\u4ec0\u4e48\u4f60\u5199\u7684 Java \u4ee3\u7801\u201c\u770b\u7740\u9762\u5411\u5bf9\u8c61\u3001\u5b9e\u9645\u662f\u9762\u5411\u8fc7\u7a0b\u201c\uff1f - \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\/106371.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u4e3a\u4ec0\u4e48\u4f60\u5199\u7684 Java \u4ee3\u7801\u201c\u770b\u7740\u9762\u5411\u5bf9\u8c61\u3001\u5b9e\u9645\u662f\u9762\u5411\u8fc7\u7a0b\u201c\uff1f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u300c\u8bbe\u8ba1\u6a21\u5f0f\u4e0e\u8303\u5f0f\u300d\u7cfb\u5217 Day02\u5199\u5728\u524d\u9762 \u7528 Java \u5199\u4ee3\u7801 \u2260 \u5199\u7684\u662f\u9762\u5411\u5bf9\u8c61\u98ce\u683c\u4ee3\u7801\u3002Utils \u6ee1\u5929\u98de\u3001getter\/setter \u65e0\u8111\u751f\u6210\u3001\u8d2b\u8840\u6a21\u578b\u2014\u2014\u8fd9\u4e9b\u90fd\u662f\u62ab\u7740\u9762\u5411\u5bf9\u8c61\u5916\u76ae\u7684\u9762\u5411\u8fc7\u7a0b\u4ee3\u7801\u3002 \u8fd9\u7bc7\u5148\u6253\u5730\u57fa&#xff1a;OOP \u662f\u4ec0\u4e48\u3001\u56db\u5927\u7279\u6027\u5404\u89e3\u51b3\u4ec0\u4e48\u95ee\u9898&#xff0c;\u518d\u770b\u51e0\u4e2a&quot;\u770b\u7740\u9762\u5411\u5bf9\u8c61\u3001\u5b9e\u9645\u9762\u5411\u8fc7\u7a0b&quot;\u7684\u53cd\u4f8b\u3002\u4e00\u3001\u662f\u4ec0\u4e48 \u9762\u5411\u5bf9\u8c61\u7f16\u7a0b&#xff08;OOP&#xff09;&#xff1a;\u4ee5\u7c7b\/\u5bf9\u8c61\u4e3a\u57fa\u672c\u5355\u5143&#xff0c;\u5c01\u88c5\u3001\u62bd\u8c61\u3001\u7ee7\u627f\u3001\u591a\u6001\u4e3a\u57fa\u77f3\u7684\u7f16\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/106371.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-17T01:48:35+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\/106371.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/106371.html\",\"name\":\"\u4e3a\u4ec0\u4e48\u4f60\u5199\u7684 Java \u4ee3\u7801\u201c\u770b\u7740\u9762\u5411\u5bf9\u8c61\u3001\u5b9e\u9645\u662f\u9762\u5411\u8fc7\u7a0b\u201c\uff1f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-09-17T01:48:35+00:00\",\"dateModified\":\"2026-09-17T01:48:35+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/106371.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/106371.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/106371.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u4e3a\u4ec0\u4e48\u4f60\u5199\u7684 Java \u4ee3\u7801\u201c\u770b\u7740\u9762\u5411\u5bf9\u8c61\u3001\u5b9e\u9645\u662f\u9762\u5411\u8fc7\u7a0b\u201c\uff1f\"}]},{\"@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":"\u4e3a\u4ec0\u4e48\u4f60\u5199\u7684 Java \u4ee3\u7801\u201c\u770b\u7740\u9762\u5411\u5bf9\u8c61\u3001\u5b9e\u9645\u662f\u9762\u5411\u8fc7\u7a0b\u201c\uff1f - \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\/106371.html","og_locale":"zh_CN","og_type":"article","og_title":"\u4e3a\u4ec0\u4e48\u4f60\u5199\u7684 Java \u4ee3\u7801\u201c\u770b\u7740\u9762\u5411\u5bf9\u8c61\u3001\u5b9e\u9645\u662f\u9762\u5411\u8fc7\u7a0b\u201c\uff1f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u300c\u8bbe\u8ba1\u6a21\u5f0f\u4e0e\u8303\u5f0f\u300d\u7cfb\u5217 Day02\u5199\u5728\u524d\u9762 \u7528 Java \u5199\u4ee3\u7801 \u2260 \u5199\u7684\u662f\u9762\u5411\u5bf9\u8c61\u98ce\u683c\u4ee3\u7801\u3002Utils \u6ee1\u5929\u98de\u3001getter\/setter \u65e0\u8111\u751f\u6210\u3001\u8d2b\u8840\u6a21\u578b\u2014\u2014\u8fd9\u4e9b\u90fd\u662f\u62ab\u7740\u9762\u5411\u5bf9\u8c61\u5916\u76ae\u7684\u9762\u5411\u8fc7\u7a0b\u4ee3\u7801\u3002 \u8fd9\u7bc7\u5148\u6253\u5730\u57fa&#xff1a;OOP \u662f\u4ec0\u4e48\u3001\u56db\u5927\u7279\u6027\u5404\u89e3\u51b3\u4ec0\u4e48\u95ee\u9898&#xff0c;\u518d\u770b\u51e0\u4e2a\"\u770b\u7740\u9762\u5411\u5bf9\u8c61\u3001\u5b9e\u9645\u9762\u5411\u8fc7\u7a0b\"\u7684\u53cd\u4f8b\u3002\u4e00\u3001\u662f\u4ec0\u4e48 \u9762\u5411\u5bf9\u8c61\u7f16\u7a0b&#xff08;OOP&#xff09;&#xff1a;\u4ee5\u7c7b\/\u5bf9\u8c61\u4e3a\u57fa\u672c\u5355\u5143&#xff0c;\u5c01\u88c5\u3001\u62bd\u8c61\u3001\u7ee7\u627f\u3001\u591a\u6001\u4e3a\u57fa\u77f3\u7684\u7f16","og_url":"https:\/\/www.wsisp.com\/helps\/106371.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-09-17T01:48:35+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\/106371.html","url":"https:\/\/www.wsisp.com\/helps\/106371.html","name":"\u4e3a\u4ec0\u4e48\u4f60\u5199\u7684 Java \u4ee3\u7801\u201c\u770b\u7740\u9762\u5411\u5bf9\u8c61\u3001\u5b9e\u9645\u662f\u9762\u5411\u8fc7\u7a0b\u201c\uff1f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-09-17T01:48:35+00:00","dateModified":"2026-09-17T01:48:35+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/106371.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/106371.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/106371.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u4e3a\u4ec0\u4e48\u4f60\u5199\u7684 Java \u4ee3\u7801\u201c\u770b\u7740\u9762\u5411\u5bf9\u8c61\u3001\u5b9e\u9645\u662f\u9762\u5411\u8fc7\u7a0b\u201c\uff1f"}]},{"@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\/106371","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=106371"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/106371\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=106371"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=106371"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=106371"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=106371"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}