如何轻松地将Exception子类添加到catch中? [英] How to easily add Exception subclasses into catch?
本文介绍了如何轻松地将Exception子类添加到catch中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
假设我需要在 catch
中添加一些 Exception
子类,例如这些
Let's say I need to add some Exception
subclasses into catch
, such as these ones
...//
catch (ConnectTimeoutException e) {
e.printStackTrace();
} catch (HttpHostConnectException e) {
e.printStackTrace();
}catch (IOException e) {
e.printStackTrace();
}
前两个是(显然) IOException
。
The first two are (obviously) subclasses of IOException
.
如何以比复制/粘贴更好(更快捷,更简单)的方式将这些子类添加到 catch
中?
How can I add such subclasses into catch
in a better (quicker, easier) way than copy/pasting then?
我确信IDEA具有这样的自动功能,但我不确定它是哪一个或如何使用它。
I am confident that IDEA has such automatic feature, but I am not sure which one it is or how to use it.
推荐答案
Alt + 在上输入
尝试,详情异常:
这篇关于如何轻松地将Exception子类添加到catch中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文