From 7fca193ebe902e40da4c484388c9dcc55fdccd42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=A1=90?= <2749865360@qq.com> Date: Sat, 13 May 2023 00:15:03 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=9C=89=E5=85=B3=E9=99=A4=E6=B3=95?= =?UTF-8?q?=E7=9A=84=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...02\345\270\270\350\201\224\347\263\273.md" | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 "39 \345\220\264\346\241\220/20230513 Java \345\274\202\345\270\270\350\201\224\347\263\273.md" diff --git "a/39 \345\220\264\346\241\220/20230513 Java \345\274\202\345\270\270\350\201\224\347\263\273.md" "b/39 \345\220\264\346\241\220/20230513 Java \345\274\202\345\270\270\350\201\224\347\263\273.md" new file mode 100644 index 0000000..4378550 --- /dev/null +++ "b/39 \345\220\264\346\241\220/20230513 Java \345\274\202\345\270\270\350\201\224\347\263\273.md" @@ -0,0 +1,28 @@ +```java +import java.util.InputMismatchException; +import java.util.Scanner; +//除法算数的异常。 +public class MySum { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + while (true) { + try { + System.out.println("进入除法" + + "请输入a和b,用空格隔开:"); + int a = sc.nextInt(); + int b = sc.nextInt(); + System.out.println("a/b=" + a / b); + break; + } catch (ArithmeticException a) { + System.out.println("被除数不能为零."); + } catch (InputMismatchException a) { + System.out.println("输入错误,请检查输入。"); + sc.nextLine(); + } + } + + } +} + +``` + -- Gitee From e0e09f45c6fddcd0d135a7cb76d029b507fd8644 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=A1=90?= <11828038+wenzhongdeshucai@user.noreply.gitee.com> Date: Fri, 12 May 2023 16:16:43 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D=2039=20?= =?UTF-8?q?=E5=90=B4=E6=A1=90/20230513=20Java=20=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E8=81=94=E7=B3=BB.md=20=E4=B8=BA=2039=20=E5=90=B4=E6=A1=90/202?= =?UTF-8?q?30513=20Java=20=E9=99=A4=E6=B3=95=E5=BC=82=E5=B8=B8.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0513 Java \351\231\244\346\263\225\345\274\202\345\270\270.md" | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename "39 \345\220\264\346\241\220/20230513 Java \345\274\202\345\270\270\350\201\224\347\263\273.md" => "39 \345\220\264\346\241\220/20230513 Java \351\231\244\346\263\225\345\274\202\345\270\270.md" (100%) diff --git "a/39 \345\220\264\346\241\220/20230513 Java \345\274\202\345\270\270\350\201\224\347\263\273.md" "b/39 \345\220\264\346\241\220/20230513 Java \351\231\244\346\263\225\345\274\202\345\270\270.md" similarity index 100% rename from "39 \345\220\264\346\241\220/20230513 Java \345\274\202\345\270\270\350\201\224\347\263\273.md" rename to "39 \345\220\264\346\241\220/20230513 Java \351\231\244\346\263\225\345\274\202\345\270\270.md" -- Gitee