{"id":1386,"date":"2025-08-21T16:24:39","date_gmt":"2025-08-21T08:24:39","guid":{"rendered":"https:\/\/zero-zl.cn\/?p=1386"},"modified":"2025-08-21T22:21:27","modified_gmt":"2025-08-21T14:21:27","slug":"java%e5%bc%82%e5%b8%b8","status":"publish","type":"post","link":"https:\/\/zero-zl.cn\/index.php\/2025\/08\/21\/java%e5%bc%82%e5%b8%b8\/","title":{"rendered":"Java\u5f02\u5e38"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" id=\"_1\u3001java-\u4e2d\u5f02\u5e38\u5206\u4e3a\u54ea\u4e9b\u79cd\u7c7b\"><a href=\"#_1\u3001java-\u4e2d\u5f02\u5e38\u5206\u4e3a\u54ea\u4e9b\u79cd\u7c7b\">1\u3001Java \u4e2d\u5f02\u5e38\u5206\u4e3a\u54ea\u4e9b\u79cd\u7c7b\uff1f<\/a><\/h2>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\u6309\u7167\u5f02\u5e38\u9700\u8981\u5904\u7406\u7684\u65f6\u673a\u5206\u4e3a<strong>\u7f16\u8bd1\u65f6\u5f02\u5e38\uff08\u4e5f\u53eb\u5f3a\u5236\u6027\u5f02\u5e38\uff09\u4e5f\u53eb CheckedException<\/strong> \u548c<strong>\u8fd0\u884c\u65f6\u5f02\u5e38\uff08\u4e5f\u53eb\u975e\u5f3a\u5236\u6027\u5f02\u5e38\uff09\u4e5f\u53eb RuntimeException<\/strong>\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u53ea\u6709 java \u8bed\u8a00\u63d0\u4f9b\u4e86 Checked \u5f02\u5e38\uff0cJava \u8ba4\u4e3a Checked\u5f02\u5e38\u90fd\u662f\u53ef\u4ee5\u88ab\u5904\u7406\u7684\u5f02\u5e38\uff0c\u6240\u4ee5 Java \u7a0b\u5e8f\u5fc5\u987b\u663e\u5f0f\u5904\u7406 Checked \u5f02\u5e38\u3002\u5982\u679c\u7a0b\u5e8f\u6ca1\u6709\u5904\u7406 Checked \u5f02\u5e38\uff0c\u8be5\u7a0b\u5e8f\u5728\u7f16\u8bd1\u65f6\u5c31\u4f1a\u53d1\u751f\u9519\u8bef\u65e0\u6cd5\u7f16\u8bd1\u3002\u8fd9\u4f53\u73b0\u4e86 Java \u7684\u8bbe\u8ba1\u54f2\u5b66\uff1a\u6ca1\u6709\u5b8c\u5584\u9519\u8bef\u5904\u7406\u7684\u4ee3\u7801\u6839\u672c\u6ca1\u6709\u673a\u4f1a\u88ab\u6267\u884c\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5bf9 Checked \u5f02\u5e38\u5904\u7406\u65b9\u6cd5\u6709\u4e24\u79cd\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u5f53\u524d\u65b9\u6cd5\u77e5\u9053\u5982\u4f55\u5904\u7406\u8be5\u5f02\u5e38\uff0c\u5219\u7528 try&#8230;catch \u5757\u6765\u5904\u7406\u8be5\u5f02\u5e38\u3002<\/li>\n\n\n\n<li>\u5f53\u524d\u65b9\u6cd5\u4e0d\u77e5\u9053\u5982\u4f55\u5904\u7406\uff0c\u5219\u5728\u5b9a\u4e49\u8be5\u65b9\u6cd5\u662f\u58f0\u660e\u629b\u51fa\u8be5\u5f02\u5e38\u3002<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd0\u884c\u65f6\u5f02\u5e38\u53ea\u6709\u5f53\u4ee3\u7801\u5728\u8fd0\u884c\u65f6\u624d\u53d1\u884c\u7684\u5f02\u5e38\uff0c\u7f16\u8bd1\u65f6\u4e0d\u9700\u8981 try catch\u3002Runtime \u5982<strong>\u9664\u6570\u662f 0<\/strong> \u548c\u6570\u7ec4\u4e0b\u6807\u8d8a\u754c\u7b49\uff0c\u5176\u4ea7\u751f\u9891\u7e41\uff0c\u5904\u7406\u9ebb\u70e6\uff0c\u82e5\u663e\u793a\u7533\u660e\u6216\u8005\u6355\u83b7\u5c06\u4f1a\u5bf9\u7a0b\u5e8f\u7684\u53ef\u8bfb\u6027\u548c\u8fd0\u884c\u6548\u7387\u5f71\u54cd\u5f88\u5927\u3002\u6240\u4ee5\u7531\u7cfb\u7edf\u81ea\u52a8\u68c0\u6d4b\u5e76\u5c06\u5b83\u4eec\u4ea4\u7ed9\u7f3a\u7701\u7684\u5f02\u5e38\u5904\u7406\u7a0b\u5e8f\u3002\u5f53\u7136\u5982\u679c\u4f60\u6709\u5904\u7406\u8981\u6c42\u4e5f\u53ef\u4ee5\u663e\u793a\u6355\u83b7\u5b83\u4eec\u3002<\/p>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"_2\u3001\u8c03\u7528\u4e0b\u9762\u7684\u65b9\u6cd5-\u5f97\u5230\u7684\u8fd4\u56de\u503c\u662f\u4ec0\u4e48\"><a href=\"#_2\u3001\u8c03\u7528\u4e0b\u9762\u7684\u65b9\u6cd5-\u5f97\u5230\u7684\u8fd4\u56de\u503c\u662f\u4ec0\u4e48\">2\u3001\u8c03\u7528\u4e0b\u9762\u7684\u65b9\u6cd5\uff0c\u5f97\u5230\u7684\u8fd4\u56de\u503c\u662f\u4ec0\u4e48\uff1f<\/a><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>public int getNum(){\n    try{\n       int i = 10 \/ 0;\n        return 1;\n    }catch(Exception e){\n        return 2;\n\t}finally{\n        return 3;\n    }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u5206\u6790<\/strong>\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u4ee3\u7801\u8d70\u5230\u7b2c3\u884c\u7684\u65f6\u5019\uff0c\u9047\u5230\u4e86\u4e00\u4e2a MathException\uff0c\u56e0\u6b64\u7b2c4\u884c\u4e0d\u4f1a\u6267\u884c\u4e86\uff0c\u4ee3\u7801\u8df3\u5230catch\u91cc\u9762<\/li>\n\n\n\n<li>\u4ee3\u7801\u8d70\u5230\u7b2c6\u884c\u7684\u65f6\u5019\uff0c\u5f02\u5e38\u673a\u5236\u6709\u8fd9\u4e48\u4e00\u4e2a\u539f\u5219\uff1a\u5982\u679c\u5728 catch \u4e2d\u9047\u5230\u4e86 return \u6216\u8005\u5f02\u5e38\u7b49\u80fd\u4f7f\u8be5\u51fd\u6570\u7ec8\u6b62\u7684\u8bdd\uff0c\u90a3\u4e48\u6709 finally \u5c31\u5fc5\u987b\u5148\u6267\u884c\u5b8c finally \u4ee3\u7801\u5757\u91cc\u9762\u7684\u4ee3\u7801\uff0c\u7136\u540e\u518d\u8fd4\u56de\u503c\u3002\u56e0\u6b64\u8df3\u5230\u7b2c8\u884c\u3002<\/li>\n\n\n\n<li>\u7b2c8\u884c\u662f\u4e00\u4e2areturn\u8bed\u53e5\uff0c\u8fd9\u4e2a\u65f6\u5019\u5c31\u7ed3\u675f\u4e86\uff0c\u7b2c6\u884c\u7684\u503c\u65e0\u6cd5\u88ab\u8fd4\u56de\u3002\u8fd4\u56de\u503c\u4e3a3.<\/li>\n\n\n\n<li>\u82e5\u7b2c8\u884c\u4e0d\u662f\u4e00\u4e2areturn\u8bed\u53e5\uff0c\u800c\u662f\u4e00\u4e2a\u91ca\u653e\u8d44\u6e90\u7684\u64cd\u4f5c\uff0c\u5219\u8fd4\u56de\u503c\u4e3a2.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"_3\u3001error-\u548c-exception-\u533a\u522b\u662f\u4ec0\u4e48\"><a href=\"#_3\u3001error-\u548c-exception-\u533a\u522b\u662f\u4ec0\u4e48\">3\u3001Error \u548c Exception \u533a\u522b\u662f\u4ec0\u4e48\uff1f<\/a><\/h2>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<ul class=\"wp-block-list\">\n<li><strong>Error \u7c7b\u578b\u7684\u9519\u8bef\u901a\u5e38\u4e3a\u865a\u62df\u673a\u76f8\u5173\u9519\u8bef\uff0c\u5982\u7cfb\u7edf\u5d29\u6e83\uff0c\u5185\u5b58\u4e0d\u8db3\uff0c\u5806\u6808\u6ea2\u51fa<\/strong>\u7b49\uff0c\u7f16\u8bd1\u5668\u4e0d\u4f1a\u5bf9\u8fd9\u7c7b\u9519\u8bef\u8fdb\u884c\u68c0\u6d4b\uff0cJAVA \u5e94\u7528\u7a0b\u5e8f\u4e5f\u4e0d\u5e94\u5bf9\u8fd9\u7c7b\u9519\u8bef\u8fdb\u884c\u6355\u83b7\uff0c\u4e00\u65e6\u8fd9\u7c7b\u9519\u8bef\u53d1\u751f\uff0c\u901a\u5e38\u5e94\u7528\u7a0b\u5e8f\u4f1a\u88ab\u7ec8\u6b62\uff0c\u4ec5\u9760\u5e94\u7528\u7a0b\u5e8f\u672c\u8eab\u65e0\u6cd5\u6062\u590d\uff1b<\/li>\n\n\n\n<li><strong>Exception \u7c7b\u7684\u9519\u8bef\u662f\u53ef\u4ee5\u5728\u5e94\u7528\u7a0b\u5e8f\u4e2d\u8fdb\u884c\u6355\u83b7\u5e76\u5904\u7406\u7684<\/strong>\uff0c\u901a\u5e38\u9047\u5230\u8fd9\u79cd\u9519\u8bef\uff0c\u5e94\u5bf9\u5176\u8fdb\u884c\u5904\u7406\uff0c\u4f7f\u5e94\u7528\u7a0b\u5e8f\u53ef\u4ee5\u7ee7\u7eed\u6b63\u5e38\u8fd0\u884c\u3002<\/li>\n<\/ul>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"_4\u3001\u8fd0\u884c\u65f6\u5f02\u5e38\u548c\u4e00\u822c\u5f02\u5e38-\u53d7\u68c0\u5f02\u5e38-\u533a\u522b\u662f\u4ec0\u4e48\"><a href=\"#_4\u3001\u8fd0\u884c\u65f6\u5f02\u5e38\u548c\u4e00\u822c\u5f02\u5e38-\u53d7\u68c0\u5f02\u5e38-\u533a\u522b\u662f\u4ec0\u4e48\">4\u3001\u8fd0\u884c\u65f6\u5f02\u5e38\u548c\u4e00\u822c\u5f02\u5e38(\u53d7\u68c0\u5f02\u5e38)\u533a\u522b\u662f\u4ec0\u4e48\uff1f<\/a><\/h2>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<ul class=\"wp-block-list\">\n<li><strong>\u8fd0\u884c\u65f6\u5f02\u5e38\u5305\u62ec RuntimeException \u7c7b\u53ca\u5176\u5b50\u7c7b<\/strong>\uff0c\u8868\u793a JVM \u5728\u8fd0\u884c\u671f\u95f4\u53ef\u80fd\u51fa\u73b0\u7684\u5f02\u5e38\u3002 Java \u7f16\u8bd1\u5668\u4e0d\u4f1a\u68c0\u67e5\u8fd0\u884c\u65f6\u5f02\u5e38\u3002<\/li>\n\n\n\n<li>\u53d7<strong>\u68c0\u5f02\u5e38\u662fException \u4e2d\u9664 RuntimeException \u53ca\u5176\u5b50\u7c7b\u4e4b\u5916\u7684\u5f02\u5e38<\/strong>\u3002 Java \u7f16\u8bd1\u5668\u4f1a\u68c0\u67e5\u53d7\u68c0\u5f02\u5e38\u3002<\/li>\n\n\n\n<li><strong>RuntimeException\u5f02\u5e38\u548c\u53d7\u68c0\u5f02\u5e38\u4e4b\u95f4\u7684\u533a\u522b<\/strong>\uff1a\u662f\u5426\u5f3a\u5236\u8981\u6c42\u8c03\u7528\u8005\u5fc5\u987b\u5904\u7406\u6b64\u5f02\u5e38\uff0c\u5982\u679c\u5f3a\u5236\u8981\u6c42\u8c03\u7528\u8005\u5fc5\u987b\u8fdb\u884c\u5904\u7406\uff0c\u90a3\u4e48\u5c31\u4f7f\u7528\u53d7\u68c0\u5f02\u5e38\uff0c\u5426\u5219\u5c31\u9009\u62e9\u975e\u53d7\u68c0\u5f02\u5e38(RuntimeException)\u3002<\/li>\n\n\n\n<li>\u4e00\u822c\u6765\u8bb2\uff0c\u5982\u679c\u6ca1\u6709\u7279\u6b8a\u7684\u8981\u6c42\uff0c\u6211\u4eec\u5efa\u8bae\u4f7f\u7528RuntimeException\u5f02\u5e38\u3002<\/li>\n<\/ul>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"_5\u3001throw-\u548c-throws-\u7684\u533a\u522b\u662f\u4ec0\u4e48\"><a href=\"#_5\u3001throw-\u548c-throws-\u7684\u533a\u522b\u662f\u4ec0\u4e48\">5\u3001throw \u548c throws \u7684\u533a\u522b\u662f\u4ec0\u4e48\uff1f<\/a><\/h2>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"><strong>throw:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>throw \u8bed\u53e5\u7528\u5728\u65b9\u6cd5\u4f53\u5185\uff0c\u8868\u793a\u629b\u51fa\u5f02\u5e38\uff0c\u7531\u65b9\u6cd5\u4f53\u5185\u7684\u8bed\u53e5\u5904\u7406\u3002<\/li>\n\n\n\n<li>throw \u662f\u5177\u4f53\u5411\u5916\u629b\u51fa\u5f02\u5e38\u7684\u52a8\u4f5c\uff0c\u6240\u4ee5\u5b83\u629b\u51fa\u7684\u662f\u4e00\u4e2a\u5f02\u5e38\u5b9e\u4f8b\uff0c\u6267\u884c throw \u4e00\u5b9a\u662f\u629b\u51fa\u4e86\u67d0\u79cd\u5f02\u5e38\u3002<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>throws:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>throws \u8bed\u53e5\u662f\u7528\u5728\u65b9\u6cd5\u58f0\u660e\u540e\u9762\uff0c\u8868\u793a\u5982\u679c\u629b\u51fa\u5f02\u5e38\uff0c\u7531\u8be5\u65b9\u6cd5\u7684\u8c03\u7528\u8005\u6765\u8fdb\u884c\u5f02\u5e38\u7684\u5904\u7406\u3002<\/li>\n\n\n\n<li>throws \u4e3b\u8981\u662f\u58f0\u660e\u8fd9\u4e2a\u65b9\u6cd5\u4f1a\u629b\u51fa\u67d0\u79cd\u7c7b\u578b\u7684\u5f02\u5e38\uff0c\u8ba9\u5b83\u7684\u4f7f\u7528\u8005\u8981\u77e5\u9053\u9700\u8981\u6355\u83b7\u7684\u5f02\u5e38\u7684\u7c7b\u578b\u3002<\/li>\n\n\n\n<li>throws \u8868\u793a\u51fa\u73b0\u5f02\u5e38\u7684\u4e00\u79cd\u53ef\u80fd\u6027\uff0c\u5e76\u4e0d\u4e00\u5b9a\u4f1a\u53d1\u751f\u8fd9\u79cd\u5f02\u5e38\u3002<\/li>\n<\/ul>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"_6\u3001final\u3001finally\u3001finalize-\u7684\u533a\u522b\"><a href=\"#_6\u3001final\u3001finally\u3001finalize-\u7684\u533a\u522b\">6\u3001final\u3001finally\u3001finalize \u7684\u533a\u522b\uff1f<\/a><\/h2>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"><strong>final<\/strong>\uff1a\u53ef\u7528\u4e8e\u4fee\u9970\u5c5e\u6027\u3001\u65b9\u6cd5\u3001\u7c7b\u3002\u4fee\u9970\u7684\u5c5e\u6027\u4e0d\u53ef\u53d8\uff08\u4e0d\u80fd\u91cd\u65b0\u88ab\u8d4b\u503c\uff09\uff0c\u65b9\u6cd5\u4e0d\u80fd\u91cd\u5199\uff0c\u7c7b\u4e0d\u80fd\u7ee7\u627f\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>finally<\/strong>\uff1a\u5f02\u5e38\u5904\u7406\u8bed\u53e5try-catch\u7684\u4e00\u90e8\u5206\uff0c\u4e00\u822c\u5c06\u4e00\u5b9a\u8981\u6267\u884c\u7684\u4ee3\u7801\u653e\u5728finally\u4ee3\u7801\u5757\u4e2d\uff0c\u603b\u662f\u88ab\u6267\u884c\uff0c\u4e00\u822c\u7528\u6765\u5b58\u653e\u4e00\u4e9b\u5173\u95ed\u8d44\u6e90\u7684\u64cd\u4f5c\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>finalize<\/strong>\uff1aObject \u7c7b\u7684\u4e00\u4e2a\u65b9\u6cd5\uff0c\u5728\u5783\u573e\u56de\u6536\u5668\u6267\u884c\u7684\u65f6\u5019\u4f1a\u8c03\u7528\u88ab\u56de\u6536\u5bf9\u8c61\u7684\u6b64\u65b9\u6cd5\uff0c\u53ef\u4ee5\u8986\u76d6\u6b64\u65b9\u6cd5\u63d0\u4f9b\u5783\u573e\u6536\u96c6\u65f6\u7684\u5176\u4ed6\u8d44\u6e90\u56de\u6536\uff0c\u4f8b\u5982\u5173\u95ed\u6587\u4ef6\u7b49\u3002\u8be5\u65b9\u6cd5\u66f4\u50cf\u662f\u4e00\u4e2a\u5bf9\u8c61\u751f\u547d\u5468\u671f\u7684\u4e34\u7ec8\u65b9\u6cd5\uff0c\u5f53\u8be5\u65b9\u6cd5\u88ab\u7cfb\u7edf\u8c03\u7528\u5219\u4ee3\u8868\u8be5\u5bf9\u8c61\u5373\u5c06\u201c\u6b7b\u4ea1\u201d\uff0c\u4f46\u662f\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u6211\u4eec\u4e3b\u52a8\u884c\u4e3a\u4e0a\u53bb\u8c03\u7528\u8be5\u65b9\u6cd5\u5e76\u4e0d\u4f1a\u5bfc\u81f4\u8be5\u5bf9\u8c61\u201c\u6b7b\u4ea1\u201d\uff0c\u8fd9\u662f\u4e00\u4e2a\u88ab\u52a8\u7684\u65b9\u6cd5\uff08\u5176\u5b9e\u5c31\u662f\u56de\u8c03\u65b9\u6cd5\uff09\uff0c\u4e0d\u9700\u8981\u6211\u4eec\u8c03\u7528\u3002<\/p>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"_7\u3001\u5e38\u89c1\u7684-runtimeexception-\u6709\u54ea\u4e9b\"><a href=\"#_7\u3001\u5e38\u89c1\u7684-runtimeexception-\u6709\u54ea\u4e9b\">7\u3001\u5e38\u89c1\u7684 RuntimeException \u6709\u54ea\u4e9b\uff1f<\/a><\/h2>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<ul class=\"wp-block-list\">\n<li><strong>ClassCastException<\/strong>\uff1a\u6570\u636e\u7c7b\u578b\u8f6c\u6362\u5f02\u5e38<\/li>\n\n\n\n<li><strong>IndexOutOfBoundsException<\/strong>\uff1a\u6570\u7ec4\u4e0b\u6807\u8d8a\u754c\u5f02\u5e38\uff0c\u5e38\u89c1\u4e8e\u64cd\u4f5c\u6570\u7ec4\u5bf9\u8c61\u65f6\u53d1\u751f\u3002<\/li>\n\n\n\n<li><strong>NullPointerException<\/strong>\uff1a\u7a7a\u6307\u9488\u5f02\u5e38\uff1b\u51fa\u73b0\u539f\u56e0\uff1a\u8c03\u7528\u4e86\u672a\u7ecf\u521d\u59cb\u5316\u7684\u5bf9\u8c61\u6216\u8005\u662f\u4e0d\u5b58\u5728\u7684\u5bf9\u8c61\u3002<\/li>\n\n\n\n<li><strong>ClassNotFoundException<\/strong>\uff1a\u6307\u5b9a\u7684\u7c7b\u627e\u4e0d\u5230\uff1b\u51fa\u73b0\u539f\u56e0\uff1a\u7c7b\u7684\u540d\u79f0\u548c\u8def\u5f84\u52a0\u8f7d\u9519\u8bef\uff1b\u901a\u5e38\u90fd\u662f\u7a0b\u5e8f\u8bd5\u56fe\u901a\u8fc7\u5b57\u7b26\u4e32\u6765\u52a0\u8f7d\u67d0\u4e2a\u7c7b\u65f6\u53ef\u80fd\u5f15\u53d1\u5f02\u5e38\u3002<\/li>\n\n\n\n<li><strong>NumberFormatException<\/strong>\uff1a\u5b57\u7b26\u4e32\u8f6c\u6362\u4e3a\u6570\u5b57\u5f02\u5e38\uff1b\u51fa\u73b0\u539f\u56e0\uff1a\u5b57\u7b26\u578b\u6570\u636e\u4e2d\u5305\u542b\u975e\u6570\u5b57\u578b\u5b57\u7b26\u3002<\/li>\n\n\n\n<li><strong>IllegalArgumentException<\/strong>\uff1a\u65b9\u6cd5\u4f20\u9012\u53c2\u6570\u5f02\u5e38<\/li>\n\n\n\n<li><strong>NoClassDefFoundException<\/strong>\uff1a\u672a\u627e\u5230\u5b9a\u4e49\u7c7b\u5f02\u5e38<\/li>\n\n\n\n<li><strong>SQLException SQL<\/strong>\uff1a\u5e38\u89c1\u4e8e\u64cd\u4f5c\u6570\u636e\u5e93\u65f6\u7684 SQL \u8bed\u53e5\u9519\u8bef\u3002<\/li>\n\n\n\n<li><strong>InstantiationException<\/strong>\uff1a\u5b9e\u4f8b\u5316\u5f02\u5e38\u3002<\/li>\n\n\n\n<li><strong>NoSuchMethodException<\/strong>\uff1a\u65b9\u6cd5\u4e0d\u5b58\u5728\u5f02\u5e38<\/li>\n\n\n\n<li><strong>ArrayStoreException<\/strong>\uff1a\u6570\u636e\u5b58\u50a8\u5f02\u5e38\uff0c\u64cd\u4f5c\u6570\u7ec4\u65f6\u7c7b\u578b\u4e0d\u4e00\u81f4<\/li>\n\n\n\n<li>\u8fd8\u6709IO\u64cd\u4f5c\u7684BufferOverflowException\u5f02\u5e38<\/li>\n<\/ul>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"_8\u3001finally\u5185\u5b58\u56de\u6536\u7684\u60c5\u51b5\"><a href=\"#_8\u3001finally\u5185\u5b58\u56de\u6536\u7684\u60c5\u51b5\">8\u3001finally\u5185\u5b58\u56de\u6536\u7684\u60c5\u51b5\uff1f<\/a><\/h2>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<ol class=\"wp-block-list\">\n<li>\u5982\u679c\u5728try&#8230; catch \u90e8\u5206\u7528Connection \u5bf9\u8c61\u8fde\u63a5\u4e86\u6570\u636e\u5e93\uff0c\u800c\u4e14\u5728\u540e\u7ee7\u90e8\u53f0\u4e0d\u4f1a\u518d\u7528\u5230\u8fd9\u4e2a\u8fde\u63a5\u5bf9\u8c61\uff0c\u90a3\u4e48\u4e00\u5b9a\u8981\u5728 finally\u4ece\u53e5\u4e2d\u5173\u95ed\u8be5\u8fde\u63a5\u5bf9\u8c61\uff0c \u5426\u5219\u8be5\u8fde\u63a5\u5bf9\u8c61\u6240\u5360\u7528\u7684\u5185\u5b58\u8d44\u6e90\u65e0\u6cd5\u88ab\u56de\u6536\u3002<\/li>\n\n\n\n<li>\u5982\u679c\u5728try&#8230; catch \u90e8\u5206\u7528\u5230\u4e86\u4e00\u4e9bIO\u5bf9\u8c61\u8fdb\u884c\u4e86\u8bfb\u5199\u64cd\u4f5c\uff0c\u90a3\u4e48\u4e5f\u4e00\u5b9a\u8981\u5728finally \u4e2d\u5173\u95ed\u8fd9\u4e9bIO\u5bf9\u8c61\uff0c\u5426\u5219\uff0cIO\u5bf9\u8c61\u6240\u5360\u7528\u7684\u5185\u5b58\u8d44\u6e90\u65e0\u6cd5\u88ab\u56de\u6536\u3002<\/li>\n\n\n\n<li>\u5982\u679c\u5728try .catch \u90e8\u5206\u7528\u5230\u4e86ArrayList \u3001Linkedlist \u3001Hash Map \u7b49\u96c6\u5408\u5bf9\u8c61\uff0c\u800c\u4e14\u8fd9\u4e9b\u5bf9\u8c61\u4e4b\u540e\u4e0d\u4f1a\u518d\u88ab\u7528\u5230\uff0c\u90a3\u4e48\u5728finally\u4e2d\u5efa\u8bae\u901a\u8fc7\u8c03\u7528clear\u65b9\u6cd5\u6765\u6e05\u7a7a\u8fd9\u4e9b\u96c6\u5408\u3002<\/li>\n\n\n\n<li>\u4f8b\u5982\uff0c\u5728try .catch \u8bed\u53e5\u4e2d\u80b2\u4e00\u4e2a\u5bf9\u8c61obj \u6307\u54117\u4e00\u5757\u6bd4\u8f83\u5927\u7684\u5185\u5b58\u7a7a\u95f4\uff08\u5047\u8bbe100MB) \uff0c\u800c\u4e14\u4e4b\u540e\u4e0d\u4f1a\u518d\u88ab\u7528\u5230\uff0c\u90a3\u4e48\u5728 finally \u4ece\u53e5\u4e2d\u5efa\u8bae\u5199\u4e0a obj=null\uff0c\u8fd9\u6837\u80fd\u63d0\u5347\u5185\u5b58\u4f7f\u7528\u6548\u7387\u3002<\/li>\n<\/ol>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"_9\u3001\u5f02\u5e38\u7684\u8bbe\u8ba1\u539f\u5219\u6709\u54ea\u4e9b\"><a href=\"#_9\u3001\u5f02\u5e38\u7684\u8bbe\u8ba1\u539f\u5219\u6709\u54ea\u4e9b\">9\u3001\u5f02\u5e38\u7684\u8bbe\u8ba1\u539f\u5219\u6709\u54ea\u4e9b\uff1f<\/a><\/h2>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<ul class=\"wp-block-list\">\n<li>\u4e0d\u8981\u5c06\u5f02\u5e38\u5904\u7406\u7528\u4e8e\u6b63\u5e38\u7684\u63a7\u5236\u6d41<\/li>\n\n\n\n<li>\u5bf9\u53ef\u4ee5\u6062\u590d\u7684\u60c5\u51b5\u4f7f\u7528\u53d7\u68c0\u5f02\u5e38\uff0c\u5bf9\u7f16\u7a0b\u9519\u8bef\u4f7f\u7528\u8fd0\u884c\u65f6\u5f02\u5e38<\/li>\n\n\n\n<li>\u907f\u514d\u4e0d\u5fc5\u8981\u7684\u4f7f\u7528\u53d7\u68c0\u5f02\u5e38<\/li>\n\n\n\n<li>\u4f18\u5148\u4f7f\u7528\u6807\u51c6\u7684\u5f02\u5e38<\/li>\n\n\n\n<li>\u6bcf\u4e2a\u65b9\u6cd5\u629b\u51fa\u7684\u5f02\u5e38\u90fd\u8981\u6709\u6587\u6863<\/li>\n\n\n\n<li>\u4fdd\u6301\u5f02\u5e38\u7684\u539f\u5b50\u6027<\/li>\n\n\n\n<li>\u4e0d\u8981\u5728 catch \u4e2d\u5ffd\u7565\u6389\u6355\u83b7\u5230\u7684\u5f02\u5e38<\/li>\n<\/ul>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n","protected":false},"excerpt":{"rendered":"<p>1\u3001Java \u4e2d\u5f02\u5e38\u5206\u4e3a\u54ea\u4e9b\u79cd\u7c7b\uff1f 2\u3001\u8c03\u7528\u4e0b\u9762\u7684\u65b9\u6cd5\uff0c\u5f97\u5230\u7684\u8fd4\u56de\u503c\u662f\u4ec0\u4e48\uff1f \u5206\u6790\uff1a 3\u3001Error \u548c Ex [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":234,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[103,104],"tags":[],"class_list":["post-1386","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java"],"_links":{"self":[{"href":"https:\/\/zero-zl.cn\/index.php\/wp-json\/wp\/v2\/posts\/1386","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zero-zl.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zero-zl.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zero-zl.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/zero-zl.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1386"}],"version-history":[{"count":1,"href":"https:\/\/zero-zl.cn\/index.php\/wp-json\/wp\/v2\/posts\/1386\/revisions"}],"predecessor-version":[{"id":1387,"href":"https:\/\/zero-zl.cn\/index.php\/wp-json\/wp\/v2\/posts\/1386\/revisions\/1387"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/zero-zl.cn\/index.php\/wp-json\/wp\/v2\/media\/234"}],"wp:attachment":[{"href":"https:\/\/zero-zl.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1386"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zero-zl.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1386"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zero-zl.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1386"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}