From a63c0635df3ac45a745dc50973879dda7883afb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E6=95=8F?= <3234934487@qq.com> Date: Thu, 11 May 2023 10:30:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=9C=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" | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 "56 \350\265\265\346\225\217/20230510 \345\274\202\345\270\270\344\275\234\344\270\232.md" diff --git "a/56 \350\265\265\346\225\217/20230510 \345\274\202\345\270\270\344\275\234\344\270\232.md" "b/56 \350\265\265\346\225\217/20230510 \345\274\202\345\270\270\344\275\234\344\270\232.md" new file mode 100644 index 0000000..479a2d9 --- /dev/null +++ "b/56 \350\265\265\346\225\217/20230510 \345\274\202\345\270\270\344\275\234\344\270\232.md" @@ -0,0 +1,22 @@ +```Java +public class Test1 { + public static void main(String[] args) { + + while (true){ + Scanner sc = new Scanner(System.in); + try { + System.out.println("请输入两个整数"); + System.out.println("第一个整数"); + int a= sc.nextInt(); + System.out.println("第二个整数"); + int b=sc.nextInt(); + System.out.println(a+b); + } catch (Exception e) { + System.out.println("不可以输入整数以外的数字"); + } + } + + } +} +``` + -- Gitee