?class ?Demo{ int div(int a,int b)throws ? FuShuException { if(b<0) throw ?new ?FushuException(); return ?a/b; }}class ?ExceptionDemo3{ public ?static ?void ?main(String[] args) { Demo ?d=new ?Demo(); try { int ?x=d.div(4,1); System.out.println("x="+x); } catch(FuShuException e) { System.out.println(e.toString()); System.out.println("除數(shù)出現(xiàn)負數(shù)了"); } System.out.println("over");}}
添加回答
舉報
0/150
提交
取消