示例中的异常处理 [英] Exception Handling in Example

查看:73
本文介绍了示例中的异常处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好.
我需要有人向我详细解释这段代码如何处理异常以及我们如何通过方法调用异常?

Hello.
I need somebody to explain to me in detail how this code handle the exceptions and how we call the exception through a method?

class SubException extends Exception { }
 class SubSubException extends SubException { }

 public class CC { void doStuff() throws SubException { } }

 class CC2 extends CC { void doStuff() throws SubSubException { } }
 class CC3 extends CC { void doStuff() throws Exception { } }

 class CC4 extends CC { void doStuff(int x) throws Exception { } }

 class CC5 extends CC { void doStuff() { } }


并可以抛出异常以覆盖方法吗?
谢谢.


and can throw exception to override method ?
Thanks.

推荐答案

此处有相同问题 [ ^ ]

这里是有关此问题的完整教程. [
same question here[^]

And here a complete tutorial on this issue.[^]


这篇关于示例中的异常处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆