Java异常处理: 一个男人和一个女人的故事

 1. If you can't handle an exception, don't catch it.

 

如果你不能好好对待她,不要骚扰她。

 

2. Catch an exception as close as possible to its source.

 

如果你想追求她,首先你要靠近她。

 

3. If you catch an exception, don't swallow it.

 

如果你已得到她,就要善待她。

 

4. Log an exception where you catch it, unless you plan to re-throw it.

 

如果你已得到她,就要好好了解她,除非你想抛弃她。

 

5. Never throw unchecked exceptions in your methods just because they clutter the method signature.

 

如果你已抛弃她,就要提醒别人继续追求她。

 

6. Preserve the stack trace when you re-throw the exception by wrapping the original exception in the new one.

 

如果你想抛弃一个全新的她,请尽量保留那个旧的她,以便别人还能够认出她。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值