{"id":66343,"date":"2025-05-03T12:14:30","date_gmt":"2025-05-03T04:14:30","guid":{"rendered":"https:\/\/fwq.ai\/blog\/66343\/"},"modified":"2025-05-03T12:14:30","modified_gmt":"2025-05-03T04:14:30","slug":"%e9%a1%b9%e7%9b%ae-%e5%af%b9%e5%8f%af%e6%81%a2%e5%a4%8d%e6%9d%a1%e4%bb%b6%e4%bd%bf%e7%94%a8%e6%a3%80%e6%9f%a5%e5%bc%82%e5%b8%b8%ef%bc%8c%e5%af%b9%e7%bc%96%e7%a8%8b%e9%94%99%e8%af%af%e4%bd%bf-3","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/66343\/","title":{"rendered":"\u9879\u76ee \u5bf9\u53ef\u6062\u590d\u6761\u4ef6\u4f7f\u7528\u68c0\u67e5\u5f02\u5e38\uff0c\u5bf9\u7f16\u7a0b\u9519\u8bef\u4f7f\u7528\u8fd0\u884c\u65f6\u5f02\u5e38"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173163294425573.jpg\" class=\"aligncenter\" title=\"\u9879\u76ee \u5bf9\u53ef\u6062\u590d\u6761\u4ef6\u4f7f\u7528\u68c0\u67e5\u5f02\u5e38\uff0c\u5bf9\u7f16\u7a0b\u9519\u8bef\u4f7f\u7528\u8fd0\u884c\u65f6\u5f02\u5e38\u63d2\u56fe\" alt=\"\u9879\u76ee \u5bf9\u53ef\u6062\u590d\u6761\u4ef6\u4f7f\u7528\u68c0\u67e5\u5f02\u5e38\uff0c\u5bf9\u7f16\u7a0b\u9519\u8bef\u4f7f\u7528\u8fd0\u884c\u65f6\u5f02\u5e38\u63d2\u56fe\" \/><\/p>\n<p><strong>java \u4e2d\u7684\u5f02\u5e38\u7c7b\u578b\uff1a<\/strong><\/p>\n<p>\u68c0\u67e5\u5f02\u5e38\uff1a\u7528\u4e8e\u8c03\u7528\u8005\u53ef\u4ee5\u6062\u590d\u7684\u53ef\u6062\u590d\u6761\u4ef6\u3002<br \/> \u8fd0\u884c\u65f6\u5f02\u5e38\uff1a\u9488\u5bf9\u7f16\u7a0b\u9519\u8bef\uff0c\u4f8b\u5982\u8fdd\u53cd\u524d\u63d0\u6761\u4ef6\uff08\u4f8b\u5982\uff0c\u8bbf\u95ee\u6570\u7ec4\u7684\u65e0\u6548\u7d22\u5f15\uff09\u3002<br \/> bug\uff1a\u901a\u5e38\u4e3a jvm \u4fdd\u7559\uff0c\u5f00\u53d1\u4eba\u5458\u4e0d\u5e94\u8be5\u4f7f\u7528\u3002<\/p>\n<p><strong>\u68c0\u67e5\u5f02\u5e38\u4e0e\u68c0\u67e5\u5f02\u5e38\u8fd0\u884c\u65f6\u5f02\u5e38\uff1a<\/strong><\/p>\n<p>\u5982\u679c\u8c03\u7528\u4ee3\u7801\u53ef\u4ee5\u91c7\u53d6\u884c\u52a8\u6765\u89e3\u51b3\u95ee\u9898\uff0c\u8bf7\u4f7f\u7528\u5df2\u68c0\u67e5\u7684\u5f02\u5e38\u3002<\/p>\n<p>\u4f7f\u7528\u8fd0\u884c\u65f6\u5f02\u5e38\u6765\u6307\u793a api \u5408\u7ea6\u4e2d\u7684\u7f3a\u9677\uff0c\u8fd9\u4e9b\u7f3a\u9677\u5fc5\u987b\u7531\u5f00\u53d1\u4eba\u5458\u4fee\u590d\u3002<\/p>\n<pre>\/\/ exemplo de exce\u00e7\u00e3o verificada (condi\u00e7\u00e3o recuper\u00e1vel)\npublic void readfile(string filepath) throws ioexception {\n    \/\/ c\u00f3digo para leitura do arquivo\n}\n\n\/\/ exemplo de exce\u00e7\u00e3o de runtime (erro de programa\u00e7\u00e3o)\npublic int getelement(int[] array, int index) {\n    if (index &lt; 0 || index &gt;= array.length) {\n        throw new arrayindexoutofboundsexception(\"index out of bounds\");\n    }\n    return array[index];\n}\n\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u63d0\u4f9b\u68c0\u67e5\u5f02\u5e38\u7684\u8f85\u52a9\u65b9\u6cd5\uff1a<\/strong><\/p>\n<p><span>\u70b9\u51fb\u4e0b\u8f7d<\/span>\u201c\u201d\uff1b<\/p>\n<p>\u53d7\u68c0\u5f02\u5e38\u5fc5\u987b\u5305\u542b\u5e2e\u52a9\u8c03\u7528\u8005\u5904\u7406\u5f02\u5e38\u60c5\u51b5\u7684\u65b9\u6cd5\u3002<\/p>\n<p>\u793a\u4f8b\uff1a\u5982\u679c\u7531\u4e8e\u4f59\u989d\u4e0d\u8db3\u5bfc\u81f4\u8d2d\u4e70\u5931\u8d25\uff0c\u8bf7\u63d0\u4f9b\u4e0d\u8db3\u91d1\u989d\uff0c\u4ee5\u4fbf\u547c\u53eb\u8005\u53ef\u4ee5\u67e5\u770b\u6b64\u4fe1\u606f\u3002<\/p>\n<pre>public class InsufficientFundsException extends Exception {\n    private final double deficit;\n\n    public InsufficientFundsException(double deficit) {\n        super(\"Saldo insuficiente: falta \" + deficit);\n        this.deficit = deficit;\n    }\n\n    public double getDeficit() {\n        return deficit;\n    }\n}\n\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u603b\u7ed3<\/strong><br \/> \u5728\u7279\u6b8a\u60c5\u51b5\u4e0b\u4f7f\u7528\u5f02\u5e38\uff0c\u800c\u4e0d\u662f\u4f5c\u4e3a\u66ff\u4ee3\u63a7\u5236\u6d41\u3002<br \/> \u533a\u5206\u68c0\u67e5\u5f02\u5e38\u548c\u8fd0\u884c\u65f6\u5f02\u5e38\uff0c\u4ee5\u5411\u8c03\u7528\u8005\u6307\u793a\u6240\u9700\u7684\u5904\u7406\u7c7b\u578b\u3002<br \/> \u5728\u53d7\u68c0\u67e5\u7684\u5f02\u5e38\u4e2d\u5305\u542b\u8f85\u52a9\u65b9\u6cd5\uff0c\u4ee5\u4fbf\u4e3a\u8c03\u7528\u8005\u63d0\u4f9b\u6709\u7528\u7684\u4fe1\u606f\uff0c\u4ece\u800c\u4fc3\u8fdb\u6062\u590d\u3002<br \/> \u8fd9\u4e9b\u539f\u5219\u6709\u52a9\u4e8e\u4f7f\u4ee3\u7801\u66f4\u6e05\u6670\u3001\u66f4\u9ad8\u6548\u3001\u66f4\u6613\u4e8e\u8c03\u8bd5\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u9879\u76ee \u5bf9\u53ef\u6062\u590d\u6761\u4ef6\u4f7f\u7528\u68c0\u67e5\u5f02\u5e38\uff0c\u5bf9\u7f16\u7a0b\u9519\u8bef\u4f7f\u7528\u8fd0\u884c\u65f6\u5f02\u5e38\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8IDCBABY\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>java \u4e2d\u7684\u5f02\u5e38\u7c7b\u578b\uff1a \u68c0\u67e5\u5f02\u5e38\uff1a\u7528\u4e8e\u8c03\u7528\u8005\u53ef\u4ee5\u6062\u590d\u7684\u53ef\u6062\u590d\u6761\u4ef6\u3002 \u8fd0\u884c\u65f6\u5f02\u5e38\uff1a\u9488\u5bf9\u7f16\u7a0b\u9519\u8bef\uff0c\u4f8b\u5982\u8fdd\u53cd\u524d\u63d0\u6761\u4ef6\uff08\u4f8b\u5982\uff0c\u8bbf\u95ee\u6570\u7ec4\u7684\u65e0\u6548\u7d22\u5f15\uff09\u3002 bug\uff1a\u901a\u5e38\u4e3a jvm \u4fdd\u7559\uff0c\u5f00\u53d1\u4eba\u5458\u4e0d\u5e94\u8be5\u4f7f\u7528\u3002 \u68c0\u67e5\u5f02\u5e38\u4e0e\u68c0\u67e5\u5f02\u5e38\u8fd0\u884c\u65f6\u5f02\u5e38\uff1a \u5982\u679c\u8c03\u7528\u4ee3\u7801\u53ef\u4ee5\u91c7\u53d6\u884c\u52a8\u6765\u89e3\u51b3\u95ee\u9898\uff0c\u8bf7\u4f7f\u7528\u5df2\u68c0\u67e5\u7684\u5f02\u5e38\u3002 \u4f7f\u7528\u8fd0\u884c\u65f6\u5f02\u5e38\u6765\u6307\u793a api \u5408\u7ea6\u4e2d\u7684\u7f3a\u9677\uff0c\u8fd9\u4e9b\u7f3a\u9677\u5fc5\u987b\u7531\u5f00\u53d1\u4eba\u5458\u4fee\u590d\u3002 \/\/ exemplo de exce\u00e7\u00e3o verificada (condi\u00e7\u00e3o recuper\u00e1vel) public void readfile(string filepath) throws ioexception { \/\/ c\u00f3digo para leitura do arquivo } \/\/ exemplo de exce\u00e7\u00e3o de runtime (erro de programa\u00e7\u00e3o) public int getelement(int[] array, int index) { if (index &lt; 0 || index [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-66343","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/66343","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=66343"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/66343\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=66343"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=66343"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=66343"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}