Always try to test null pointer and test casting available in the codes.
If null, or failed to cast, simply printing out some error message would be much better than the runtime exception thrown by JVM.
If null, or failed to cast, simply printing out some error message would be much better than the runtime exception thrown by JVM.
博客强调在代码里要对空指针和类型转换进行测试。若为空指针或类型转换失败,直接输出错误信息,比让JVM抛出运行时异常要好,可提高代码稳定性。

2069

被折叠的 条评论
为什么被折叠?



