diff --git "a/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230509 \345\274\202\345\270\270\344\275\234\344\270\232.md" "b/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230509 \345\274\202\345\270\270\344\275\234\344\270\232.md" new file mode 100644 index 0000000000000000000000000000000000000000..42243102f79a35e7e36309335c1ee5d2903698a5 --- /dev/null +++ "b/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230509 \345\274\202\345\270\270\344\275\234\344\270\232.md" @@ -0,0 +1,27 @@ +# 作业 + +~~~ java +import java.util.InputMismatchException; +import java.util.Scanner; + +public class Test { + public static void main(String[] args){ + while (true){ + Scanner sc = new Scanner(System.in); + try { + System.out.println("请输入第一个整数:"); + int a = sc.nextInt(); + System.out.println("请输入第二个整数:"); + int b = sc.nextInt(); + System.out.print("两个整数的和="); + System.out.println(a+b); + break; + } catch (Exception e) { + System.out.println("数字不能是整数以外的数字!"); + } + } + } +} + +~~~ +