{"id":680,"date":"2024-03-01T15:58:53","date_gmt":"2024-03-01T15:58:53","guid":{"rendered":"https:\/\/javigomez.org\/?p=680"},"modified":"2025-09-29T20:33:16","modified_gmt":"2025-09-29T20:33:16","slug":"u11-02-try-catch-ii","status":"publish","type":"post","link":"https:\/\/javigomez.org\/index.php\/2024\/03\/01\/u11-02-try-catch-ii\/","title":{"rendered":"U11-02-try catch II"},"content":{"rendered":"\n<p>El bloque try catch no solo controla los errores que se produzcan en la zona de try, sino que si hay llamadas a funciones en esta zona, tambi\u00e9n controla sus errores.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>package U2;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Comparator;\n\npublic class E00_00 {\n\n\tpublic static void main(String&#91;] args) {\n\n\t\tint c = 0;\n\t\tint d=0;\n\n\t\tboolean correcto = false;\n\n\t\tdo {\n\t\t\ttry {\n\t\t\t\tc = div(10, d);\n\t\t\t\tcorrecto = true;\n\t\t\t} catch (ArithmeticException e) {\n\t\t\t\tSystem.out.println(\"ERROR Division: \" + e);\n\t\t\t\td=1;\n\t\t\t}\n\t\t} while (!correcto);\n\n\t\tSystem.out.println(c);\n\t}\n\n\tprivate static int div(int i, int c) {\n\t\treturn (i \/ c);\n\n\t}\n}\n<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"Java U11 02 try catch II\" width=\"1200\" height=\"675\" src=\"https:\/\/www.youtube.com\/embed\/zMGyN-mDqss?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>El bloque try catch no solo controla los errores que se produzcan en la zona de try, sino que si hay llamadas a funciones en &hellip; <\/p>\n","protected":false},"author":1,"featured_media":681,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[136,139,203,334],"class_list":["post-680","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java","tag-errores","tag-exception","tag-java","tag-try-catch"],"_links":{"self":[{"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/posts\/680","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/comments?post=680"}],"version-history":[{"count":1,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/posts\/680\/revisions"}],"predecessor-version":[{"id":877,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/posts\/680\/revisions\/877"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/media\/681"}],"wp:attachment":[{"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/media?parent=680"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/categories?post=680"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/tags?post=680"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}