From f49f6462f85a966bff6a645084df112f39f342c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=BD=E6=99=9F=E5=AE=B8?= <11785147+demon-cat-fruit-orange@user.noreply.gitee.com> Date: Wed, 10 May 2023 16:00:33 +0000 Subject: [PATCH] =?UTF-8?q?=E6=96=BD=E6=99=9F=E5=AE=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 施晟宸 <11785147+demon-cat-fruit-orange@user.noreply.gitee.com> --- ...02\345\270\270\344\275\234\344\270\232.md" | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 "22 \346\226\275\346\231\237\345\256\270/\345\274\202\345\270\270\344\275\234\344\270\232.md" diff --git "a/22 \346\226\275\346\231\237\345\256\270/\345\274\202\345\270\270\344\275\234\344\270\232.md" "b/22 \346\226\275\346\231\237\345\256\270/\345\274\202\345\270\270\344\275\234\344\270\232.md" new file mode 100644 index 0000000..8b3853f --- /dev/null +++ "b/22 \346\226\275\346\231\237\345\256\270/\345\274\202\345\270\270\344\275\234\344\270\232.md" @@ -0,0 +1,25 @@ +```java +import java.util.Scanner; + +public class Main { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + while (true) { + try { + System.out.println("请输入一个数字:"); + int x = sc.nextInt(); + System.out.println("请再输入一个数字:"); + int y = sc.nextInt(); + int sum =x+y; + System.out.println("这两个数的和是:" + sum); + return; + } catch (Exception e) { + System.out.println("输入的数不符合标准,请重新输入!!!"); + sc.next(); + } + + } + + } +} +``` \ No newline at end of file -- Gitee