From 7d59dbbfc6c2e87dda6f953c83a8dc993e85ccf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9C=E8=82=96=E9=92=9F=E5=87=AF=E9=9F=A9=E2=80=9D?= <“3175644391@qq.com”> Date: Tue, 9 May 2023 23:52:03 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AC=AC=E5=8D=81=E4=BA=94=E6=AC=A1=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...02\345\270\270\344\275\234\344\270\232.md" | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 "22 \350\202\226\351\222\237\345\207\257\351\237\251/20230509 \345\274\202\345\270\270\344\275\234\344\270\232.md" diff --git "a/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230509 \345\274\202\345\270\270\344\275\234\344\270\232.md" "b/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230509 \345\274\202\345\270\270\344\275\234\344\270\232.md" new file mode 100644 index 0000000..4224310 --- /dev/null +++ "b/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230509 \345\274\202\345\270\270\344\275\234\344\270\232.md" @@ -0,0 +1,27 @@ +# 作业 + +~~~ java +import java.util.InputMismatchException; +import java.util.Scanner; + +public class Test { + public static void main(String[] args){ + while (true){ + Scanner sc = new Scanner(System.in); + try { + System.out.println("请输入第一个整数:"); + int a = sc.nextInt(); + System.out.println("请输入第二个整数:"); + int b = sc.nextInt(); + System.out.print("两个整数的和="); + System.out.println(a+b); + break; + } catch (Exception e) { + System.out.println("数字不能是整数以外的数字!"); + } + } + } +} + +~~~ + -- Gitee