From c75cb828ac2f5f0afc459ff88b91f325640b812f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E4=BC=9F=E9=B9=8F?= <2237342630@qq.com> Date: Fri, 12 May 2023 22:40:37 +0800 Subject: [PATCH] =?UTF-8?q?0512=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20230512 \345\274\202\345\270\270.md" | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 "23 \345\210\230\344\274\237\351\271\217/20230512 \345\274\202\345\270\270.md" diff --git "a/23 \345\210\230\344\274\237\351\271\217/20230512 \345\274\202\345\270\270.md" "b/23 \345\210\230\344\274\237\351\271\217/20230512 \345\274\202\345\270\270.md" new file mode 100644 index 0000000..9f12430 --- /dev/null +++ "b/23 \345\210\230\344\274\237\351\271\217/20230512 \345\274\202\345\270\270.md" @@ -0,0 +1,23 @@ +```java +import java.util.InputMismatchException; +import java.util.Scanner; + +public class t1 { + 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)); + return; + }catch (Exception e){ + System.out.println("输入有误请在输入一次"); + sc.next(); + } + } + } +} +``` + -- Gitee