From 6bfdbb90a2d7dfbfe21870477e1b85f57ab18847 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=BB=BA=E5=91=A8?= <2313216418@qq.com> Date: Sat, 13 May 2023 00:10:11 +0800 Subject: [PATCH] =?UTF-8?q?19=E6=9D=8E=E5=BB=BA=E5=91=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20230513\344\275\234\344\270\232.md" | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 "19 \346\235\216\345\273\272\345\221\250/20230513\344\275\234\344\270\232.md" diff --git "a/19 \346\235\216\345\273\272\345\221\250/20230513\344\275\234\344\270\232.md" "b/19 \346\235\216\345\273\272\345\221\250/20230513\344\275\234\344\270\232.md" new file mode 100644 index 0000000..409693d --- /dev/null +++ "b/19 \346\235\216\345\273\272\345\221\250/20230513\344\275\234\344\270\232.md" @@ -0,0 +1,27 @@ +| # 题目 | | | +| ------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| | [2](https://gitee.com/class-01-grade-22/java-object-oriented-notes/pulls/473/files#e43e47a76fa3edc2c006df8d4c0ae98798fe9bdb_0_2) | | +| | [3](https://gitee.com/class-01-grade-22/java-object-oriented-notes/pulls/473/files#e43e47a76fa3edc2c006df8d4c0ae98798fe9bdb_0_3) | 用户输入两个整数,求这两个数的和,做好异常的处理 | +| | [4](https://gitee.com/class-01-grade-22/java-object-oriented-notes/pulls/473/files#e43e47a76fa3edc2c006df8d4c0ae98798fe9bdb_0_4) | | +| | [5](https://gitee.com/class-01-grade-22/java-object-oriented-notes/pulls/473/files#e43e47a76fa3edc2c006df8d4c0ae98798fe9bdb_0_5) | # 答案 | +| | [6](https://gitee.com/class-01-grade-22/java-object-oriented-notes/pulls/473/files#e43e47a76fa3edc2c006df8d4c0ae98798fe9bdb_0_6) | | +| | [7](https://gitee.com/class-01-grade-22/java-object-oriented-notes/pulls/473/files#e43e47a76fa3edc2c006df8d4c0ae98798fe9bdb_0_7) | ```java | +| | [8](https://gitee.com/class-01-grade-22/java-object-oriented-notes/pulls/473/files#e43e47a76fa3edc2c006df8d4c0ae98798fe9bdb_0_8) | **package** **num**; | +| | [9](https://gitee.com/class-01-grade-22/java-object-oriented-notes/pulls/473/files#e43e47a76fa3edc2c006df8d4c0ae98798fe9bdb_0_9) | **import** **java.util.Scanner**; | +| | [10](https://gitee.com/class-01-grade-22/java-object-oriented-notes/pulls/473/files#e43e47a76fa3edc2c006df8d4c0ae98798fe9bdb_0_10) | **public** **class** **Test** { | +| | [11](https://gitee.com/class-01-grade-22/java-object-oriented-notes/pulls/473/files#e43e47a76fa3edc2c006df8d4c0ae98798fe9bdb_0_11) | **public** **static** **void** **main**(**String**[] args) { | +| | [12](https://gitee.com/class-01-grade-22/java-object-oriented-notes/pulls/473/files#e43e47a76fa3edc2c006df8d4c0ae98798fe9bdb_0_12) | **Scanner** s = **new** **Scanner**(**System**.in); | +| | [13](https://gitee.com/class-01-grade-22/java-object-oriented-notes/pulls/473/files#e43e47a76fa3edc2c006df8d4c0ae98798fe9bdb_0_13) | **while** (**true**){ | +| | [14](https://gitee.com/class-01-grade-22/java-object-oriented-notes/pulls/473/files#e43e47a76fa3edc2c006df8d4c0ae98798fe9bdb_0_14) | **System**.out.println("请输入整数"); | +| | [15](https://gitee.com/class-01-grade-22/java-object-oriented-notes/pulls/473/files#e43e47a76fa3edc2c006df8d4c0ae98798fe9bdb_0_15) | **try** { | +| | [16](https://gitee.com/class-01-grade-22/java-object-oriented-notes/pulls/473/files#e43e47a76fa3edc2c006df8d4c0ae98798fe9bdb_0_16) | **int** a= s.nextInt(); | +| | [17](https://gitee.com/class-01-grade-22/java-object-oriented-notes/pulls/473/files#e43e47a76fa3edc2c006df8d4c0ae98798fe9bdb_0_17) | **int** b= s.nextInt(); | +| | [18](https://gitee.com/class-01-grade-22/java-object-oriented-notes/pulls/473/files#e43e47a76fa3edc2c006df8d4c0ae98798fe9bdb_0_18) | **System**.out.println("和为:" + (a+b)); | +| | [19](https://gitee.com/class-01-grade-22/java-object-oriented-notes/pulls/473/files#e43e47a76fa3edc2c006df8d4c0ae98798fe9bdb_0_19) | **break**; | +| | [20](https://gitee.com/class-01-grade-22/java-object-oriented-notes/pulls/473/files#e43e47a76fa3edc2c006df8d4c0ae98798fe9bdb_0_20) | } **catch** (**Exception** ww) { | +| | [21](https://gitee.com/class-01-grade-22/java-object-oriented-notes/pulls/473/files#e43e47a76fa3edc2c006df8d4c0ae98798fe9bdb_0_21) | **System**.out.println("类型有误,请输入整数"); | +| | [22](https://gitee.com/class-01-grade-22/java-object-oriented-notes/pulls/473/files#e43e47a76fa3edc2c006df8d4c0ae98798fe9bdb_0_22) | s=**new** **Scanner**(**System**.in); | +| | [23](https://gitee.com/class-01-grade-22/java-object-oriented-notes/pulls/473/files#e43e47a76fa3edc2c006df8d4c0ae98798fe9bdb_0_23) | } | +| | [24](https://gitee.com/class-01-grade-22/java-object-oriented-notes/pulls/473/files#e43e47a76fa3edc2c006df8d4c0ae98798fe9bdb_0_24) | } | +| | [25](https://gitee.com/class-01-grade-22/java-object-oriented-notes/pulls/473/files#e43e47a76fa3edc2c006df8d4c0ae98798fe9bdb_0_25) | } | +| | [26](https://gitee.com/class-01-grade-22/java-object-oriented-notes/pulls/473/files#e43e47a76fa3edc2c006df8d4c0ae98798fe9bdb_0_26) | } | \ No newline at end of file -- Gitee