From e3cf92db686281f14dc47f57f59e1593637dc424 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B8=B8=E7=84=93=E6=99=A8?= <1241840775@qq.com> Date: Fri, 12 May 2023 23:29:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=82=E5=B8=B8=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" | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 "20 \346\270\270\347\204\223\346\231\250/20230512 \345\274\202\345\270\270\344\275\234\344\270\232.md" diff --git "a/20 \346\270\270\347\204\223\346\231\250/20230512 \345\274\202\345\270\270\344\275\234\344\270\232.md" "b/20 \346\270\270\347\204\223\346\231\250/20230512 \345\274\202\345\270\270\344\275\234\344\270\232.md" new file mode 100644 index 0000000..8e488c6 --- /dev/null +++ "b/20 \346\270\270\347\204\223\346\231\250/20230512 \345\274\202\345\270\270\344\275\234\344\270\232.md" @@ -0,0 +1,27 @@ +# 作业 + +```java +package Test0512; + +import java.util.InputMismatchException; +import java.util.Scanner; + +public class Exc { + public static void main(String[] args) throws InputMismatchException { + Scanner sc = new Scanner(System.in); + while (true){ + try{ + System.out.println("请输入第一个整数:"); + int a= sc.nextInt(); + System.out.println("请输入第二个整数:"); + int b= sc.nextInt(); + System.out.println("两个整数的和为:"+(a+b)); + break; + }catch(Exception e){ + System.out.println("输入错误,请重新输入"); + sc.nextLine(); + } + } + } + } +``` \ No newline at end of file -- Gitee