diff --git "a/33\351\227\253\347\273\247\345\221\250/20230511\345\274\202\345\270\270\345\244\204\347\220\206\344\275\234\344\270\232.md" "b/33\351\227\253\347\273\247\345\221\250/20230511\345\274\202\345\270\270\345\244\204\347\220\206\344\275\234\344\270\232.md" new file mode 100644 index 0000000000000000000000000000000000000000..ba1b587cbc8b8126a66dad1d7c95ae9c37074c6f --- /dev/null +++ "b/33\351\227\253\347\273\247\345\221\250/20230511\345\274\202\345\270\270\345\244\204\347\220\206\344\275\234\344\270\232.md" @@ -0,0 +1,25 @@ +``` + + import java.util.Scanner; + + public class Sum { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + System.out.println("请输入两个整数"); + while (true){ + String a = sc.next(); + String b = sc.next(); + try { + int c = Integer.parseInt(a); + int d = Integer.parseInt(b); + System.out.println("这两个数的和是:"+(c+d); + break; + }catch (NumberFormatException e1) { + System.out.println("超范围,重新输入"); + }catch(Exception e2){ + System.out.println("请输入正确格式"); + } + } + } + } +``` \ No newline at end of file