Java’s compile-time checking does a pretty good job of keeping exceptions safely caged—you can’t call a method that throws a checked exception without catching the exception or declaring that your own method throws that exception. (For a great discussion on checked and unchecked exceptions and when to use each, see “Designing with Exceptions” (JavaWorld, 1998).) The compiler will also sometimes stop you from catching an exception that isn’t thrown in the try block, but not always, and not when you need it most. This Java Tip discusses this second compile-time check.
作者彙整: Dave Schweisguth
Java Tip 134: When catching exceptions, don’t cast your net too wide
分類: IT 資訊科技(信息技术), java 1 對 1 私人補習, 熱門新聞 標籤: android, App, apple, Apple Watch, ASUS, Aws, Facebook, Galaxy, Google, Huawei, iMac, IPad, iPhone, java, java absolute value, java abstract class, java array length, java array methods, java array to list, java arraylist, java boolean, java debug 教學, java education, java jdk, java 教學 android, java 教學 入門, java 教學 書, java 教學書, java 補習, JavaScript, Java虚拟机, macbook, Mobile, news, Phone, PlayStation, Samsung, smart phone, Technology, Video 在〈Java Tip 134: When catching exceptions, don’t cast your net too wide〉中留言功能已關閉
Java Tip 134: When catching exceptions, don’t cast your net too wide
Java’s compile-time checking does a pretty good job of keeping exceptions safely caged—you can’t call a method that throws a checked exception without catching the exception or declaring that your own method throws that exception. (For a great discussion on checked and unchecked exceptions and when to use each, see “Designing with Exceptions” (JavaWorld, 1998).) The compiler will also sometimes stop you from catching an exception that isn’t thrown in the try block, but not always, and not when you need it most. This Java Tip discusses this second compile-time check.
分類: IT 資訊科技(信息技术), java教學網站, 熱門新聞, 科技趣聞 標籤: android, App, apple, Apple Watch, ASUS, Aws, Facebook, Galaxy, Google, Huawei, iMac, IPad, iPhone, java, java absolute value, java abstract class, java array length, java array methods, java array to list, java arraylist, java boolean, java debug 教學, java education, java jdk, java 教學 android, java 教學 入門, java 教學 書, java 教學書, java 補習, JavaScript, Java虚拟机, macbook, Mobile, news, Phone, PlayStation, Samsung, smart phone, Technology, Video 在〈Java Tip 134: When catching exceptions, don’t cast your net too wide〉中留言功能已關閉

