java学习(126):throw向上抛出异常
生活随笔
收集整理的這篇文章主要介紹了
java学习(126):throw向上抛出异常
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
//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("余數(shù)為" + c);}}public static void main(String[] args) throws Exception{A aa=new A();//try{aa.d();//}catch (Exception e){System.out.println("輸入有誤");//}}
}
運(yùn)行結(jié)果
創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎勵來咯,堅(jiān)持創(chuàng)作打卡瓜分現(xiàn)金大獎總結(jié)
以上是生活随笔為你收集整理的java学习(126):throw向上抛出异常的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: plsql注册码
- 下一篇: 【Android】ListView控件总