diff --git "a/03\346\236\227\345\261\225/20230510 \345\274\202\345\270\270.md" "b/03\346\236\227\345\261\225/20230510 \345\274\202\345\270\270.md" new file mode 100644 index 0000000000000000000000000000000000000000..6240ba200c45fcc428d76743e094025116703c45 --- /dev/null +++ "b/03\346\236\227\345\261\225/20230510 \345\274\202\345\270\270.md" @@ -0,0 +1,33 @@ +```java +import java.util.Scanner; + +public class Main { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + + int a; + int b; + +while (true){ + try { + System.out.println("输入第一个数"); + a = sc.nextInt(); + System.out.println("输入第二个数"); + b = sc.nextInt(); + } catch (Exception e) { + System.out.println("输入的东西不对劲"); + sc.next(); + continue; + } + sum(a,b); + break; + } + } + + public static void sum(int a,int b){ + int c=a+b; + System.out.println(c); + } +} +``` +