From ad6e7c90a5c0c2e550fda684eb83bcc3f7ac6ab6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=B3=B0=E6=B1=9F?= <3047034182@qq.com> Date: Wed, 10 May 2023 21:18:35 +0800 Subject: [PATCH] =?UTF-8?q?=E2=80=9C=E5=BC=82=E5=B8=B8=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20230510\345\274\202\345\270\270.md" | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 "57 \345\210\230\346\263\260\346\261\237/20230510\345\274\202\345\270\270.md" diff --git "a/57 \345\210\230\346\263\260\346\261\237/20230510\345\274\202\345\270\270.md" "b/57 \345\210\230\346\263\260\346\261\237/20230510\345\274\202\345\270\270.md" new file mode 100644 index 0000000..c5e9e2f --- /dev/null +++ "b/57 \345\210\230\346\263\260\346\261\237/20230510\345\274\202\345\270\270.md" @@ -0,0 +1,27 @@ +```java +package homework; + +import java.util.Scanner; + +public class Test { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + while (true) { + try { + System.out.println("请输入第一个数字"); + int a = sc.nextInt(); + System.out.println("请输入第二个数字"); + int b = sc.nextInt(); + int c=a+b; + System.out.println("结果为"+c); + break; + } catch (Exception e) { + System.out.println("叫你输入数字怎么那么手贱呢,给你解决了嗷"); + sc.next(); + } + + } + + } +} +``` -- Gitee