{"id":203131,"date":"2025-05-22T12:59:27","date_gmt":"2025-05-22T04:59:27","guid":{"rendered":"https:\/\/server.hk\/cnblog\/203131\/"},"modified":"2025-05-22T12:59:27","modified_gmt":"2025-05-22T04:59:27","slug":"%e7%ac%ac9%e7%ab%a0-%e6%9c%80%e7%bb%88%e6%b5%8b%e8%af%95","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/203131\/","title":{"rendered":"\u7b2c9\u7ae0 \u6700\u7ec8\u6d4b\u8bd5"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>\u7b2c9\u7ae0 \u6700\u7ec8\u6d4b\u8bd5<\/h1>\n<p><span style=\"cursor: pointer\"><i><\/i>\u6536\u85cf<\/span>    <\/p>\n<p>\u5728IT\u884c\u4e1a\u8fd9\u4e2a\u53d1\u5c55\u66f4\u65b0\u901f\u5ea6\u5f88\u5feb\u7684\u884c\u4e1a\uff0c\u53ea\u6709\u4e0d\u505c\u6b62\u7684\u5b66\u4e60\uff0c\u624d\u4e0d\u4f1a\u88ab\u884c\u4e1a\u6240\u6dd8\u6c70\u3002\u5982\u679c\u4f60\u662f\u6587\u7ae0\u5b66\u4e60\u8005\uff0c\u90a3\u4e48\u672c\u6587\u300a\u7b2c9\u7ae0 \u6700\u7ec8\u6d4b\u8bd5\u300b\u5c31\u5f88\u9002\u5408\u4f60\uff01\u672c\u7bc7\u5185\u5bb9\u4e3b\u8981\u5305\u62ec##content_title##\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u7684\u77e5\u8bc6\u79ef\u7d2f\u6709\u6240\u5e2e\u52a9\uff0c\u52a9\u529b\u5b9e\u6218\u5f00\u53d1\uff01<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241029\/173018377867208262cebac.jpg\" class=\"aligncenter\"><\/p>\n<ol>\n<li>\u54ea\u4e2a\u7c7b\u4f4d\u4e8e\u5f02\u5e38\u5c42\u6b21\u7ed3\u6784\u7684\u9876\u90e8\uff1f<\/li>\n<li>\u7b80\u5355\u89e3\u91ca\u4e00\u4e0btry\u548ccatch\u662f\u5982\u4f55\u4f7f\u7528\u7684\u3002<\/li>\n<li>\u8fd9\u4e2a\u7247\u6bb5\u6709\u4ec0\u4e48\u95ee\u9898\u5417\uff1f <\/li>\n<\/ol>\n<pre> \/\/ ...\n vals[18] = 10;\n catch (arrayindexoutofboundsexception exc) {\n  \/\/ trata erro\n }\n<\/pre>\n<ol>\n<li>\u5982\u679c\u672a\u6355\u83b7\u5f02\u5e38\u4f1a\u53d1\u751f\u4ec0\u4e48\uff1f<\/li>\n<li>\u4e0b\u9762\u7684\u7247\u6bb5\u6709\u4ec0\u4e48\u95ee\u9898\uff1f <\/li>\n<\/ol>\n<pre> class a extends exception { ...\n class b extends a { ...\n \/\/ ...\n try {\n  \/\/ ...\n }\n catch (a exc) { ... }\n catch (b exc) { ... }\n<\/pre>\n<ol>\n<li>\u5185\u90e8 catch \u80fd\u5426\u4e3a\u5916\u90e8 catch \u91cd\u65b0\u629b\u51fa\u5f02\u5e38\uff1f<\/li>\n<li>finally \u5757\u662f\u7a0b\u5e8f\u8fd0\u884c\u4e4b\u524d\u6267\u884c\u7684\u6700\u540e\u4e00\u6bb5\u4ee3\u7801 \u7834\u574f\u3002\u8fd9\u662f\u771f\u7684\u8fd8\u662f\u5047\u7684\uff1f\u89e3\u91ca\u4f60\u7684\u7b54\u6848\u3002<\/li>\n<li>\u4ec0\u4e48\u7c7b\u578b\u7684\u5f02\u5e38\u5e94\u8be5\u5728 throws \u5b50\u53e5\u4e2d\u663e\u5f0f\u58f0\u660e \u6709\u65b9\u6cd5\u5417\uff1f<\/li>\n<li>\u8fd9\u4e2a\u7247\u6bb5\u6709\u4ec0\u4e48\u95ee\u9898\u5417\uff1f <\/li>\n<\/ol>\n<pre> class MyClass { \/\/ ... }\n \/\/ ...\n throw new MyClass();\n<\/pre>\n<ol>\n<li>\u5728\u7b2c 6 \u7ae0\u6d4b\u8bd5\u7684\u95ee\u9898 3 \u4e2d\uff0c\u60a8\u521b\u5efa\u4e86\u4e00\u4e2a stack \u7c7b\u3002\u5411\u60a8\u7684\u7c7b\u6dfb\u52a0\u81ea\u5b9a\u4e49\u5f02\u5e38\uff0c\u4ee5\u62a5\u544a\u5806\u6808\u5df2\u6ee1\u548c\u5806\u6808\u4e3a\u7a7a\u7684\u60c5\u51b5\u3002<\/li>\n<li>\u629b\u51fa\u5f02\u5e38\u7684\u4e09\u79cd\u65b9\u5f0f\u662f\u4ec0\u4e48\uff1f<\/li>\n<li>throwable \u7684\u4e24\u4e2a\u76f4\u63a5\u5b50\u7c7b\u662f\u4ec0\u4e48\uff1f<\/li>\n<li>\u4ec0\u4e48\u662f\u591a\u91cd\u6355\u83b7\u529f\u80fd\uff1f<\/li>\n<li>\u901a\u5e38\u60c5\u51b5\u4e0b\uff0c\u4ee3\u7801\u5e94\u8be5\u6355\u83b7 error \u7c7b\u578b\u5f02\u5e38\uff1f<\/li>\n<\/ol>\n<p>\u5230\u8fd9\u91cc\uff0c\u6211\u4eec\u4e5f\u5c31\u8bb2\u5b8c\u4e86\u300a\u7b2c9\u7ae0 \u6700\u7ec8\u6d4b\u8bd5\u300b\u7684\u5185\u5bb9\u4e86\u3002\u4e2a\u4eba\u8ba4\u4e3a\uff0c\u57fa\u7840\u77e5\u8bc6\u7684\u5b66\u4e60\u548c\u5de9\u56fa\uff0c\u662f\u4e3a\u4e86\u66f4\u597d\u7684\u5c06\u5176\u8fd0\u7528\u5230\u9879\u76ee\u4e2d\uff0c\u6b22\u8fce\u5173\u6ce8\u516c\u4f17\u53f7\uff0c\u5e26\u4f60\u4e86\u89e3\u66f4\u591a\u5173\u4e8e\u7684\u77e5\u8bc6\u70b9\uff01<\/p>\n<p>      \u7248\u672c\u58f0\u660e \u672c\u6587\u8f6c\u8f7d\u4e8e\uff1adev.to \u5982\u6709\u4fb5\u72af\uff0c\u8bf7\u8054\u7cfb\u5220\u9664<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7b2c9\u7ae0 \u6700\u7ec8\u6d4b\u8bd5 \u6536\u85cf \u5728IT\u884c&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4925],"tags":[],"class_list":["post-203131","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/203131","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=203131"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/203131\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=203131"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=203131"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=203131"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}