欢迎访问 生活随笔!

生活随笔

当前位置: 首页 >

java学习(126):throw向上抛出异常

发布时间:2023/12/10 53 豆豆
生活随笔 收集整理的这篇文章主要介绍了 java学习(126):throw向上抛出异常 小编觉得挺不错的,现在分享给大家,帮大家做个参考.
//throw抛出异常 import java.util.Scanner; public class test66{static class A {void d() throws Exception {int a, b, c;Scanner in = new Scanner(System.in);System.out.println("亲输入a的值");a = in.nextInt();System.out.println("请输入b的值");b = in.nextInt();c = a % b;System.out.println("余数为" + c);}}public static void main(String[] args) throws Exception{A aa=new A();//try{aa.d();//}catch (Exception e){System.out.println("输入有误");//}} }

运行结果

创作挑战赛新人创作奖励来咯,坚持创作打卡瓜分现金大奖

总结

以上是生活随笔为你收集整理的java学习(126):throw向上抛出异常的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。