摘要: Chapter 9 Exceptions Item 57: Use exceptions only for exceptional conditions 这条item的意思就是,千万不要用exception来控制control flow的终止,比如: 这段代码用异常来终止循环,这根本就不是异常的归宿 阅读全文
posted @ 2017-07-23 15:00 raytheweak 阅读(278) 评论(0) 推荐(0)
摘要: Chapter 8 General Programming Item 45: Minimize the scope of local variables local variables应该在他们要被用的地方声明,而不应该,比如,全部声明在方法开头。而且在声明的时候,记得要初始化。有个例外,比如你的 阅读全文
posted @ 2017-07-23 14:46 raytheweak 阅读(178) 评论(0) 推荐(0)
摘要: Chapter 7 Methods Item 38: Check parameters for validity 直接举例吧: java / ...其他的被我省略了 @throws ArithmeticException if m is less than or equal to 0 / publi 阅读全文
posted @ 2017-07-23 13:40 raytheweak 阅读(261) 评论(0) 推荐(0)