`
amanhu
  • 浏览: 12888 次
  • 性别: Icon_minigender_1
  • 来自: 北京
最近访客 更多访客>>
文章分类
社区版块
存档分类
最新评论

Item 58: Used checked exceptions for recoverable conditions and runtime exceptions for programming errors

 
阅读更多

1 use checked exceptions for conditions from which the caller can reasonably be expected to recover.

2 use runtime exceptions to indicate programming errors. The majority of runtime exceptions indicate precondition violations.

3.All of the unchecked throwable you implement should subclass RuntimeException.

分享到:
评论

相关推荐

    Effective Java 3rd edition(Effective Java第三版英文原版)附第二版

    Item 70: Use checked exceptions for recoverable conditions and runtime exceptions for programming errors Item 71: Avoid unnecessary use of checked exceptions Item 72: Favor the use of standard ...

    EurekaLog_7.5.0.0_Enterprise

    17)..Added: Support for relative file paths and environment variables for events and various module paths 18)..Added: Logging in Manage tool 19)..Added: Windows 10 version detection 20)..Added: Stack ...

    jQuery中:checked选择器用法实例

    `:checked`选择器的基本语法非常简单,就像这样: ```javascript $(":checked") ``` 这行代码会返回页面上所有当前被选中的复选框和单选按钮的jQuery对象集合。你可以进一步对这些元素进行各种操作,例如改变它们的...

    QT CheckBox复选框状态设置、信号绑定, setCheckState、checkState、setTristate

    它接受一个`Qt::CheckState`枚举值作为参数,该枚举定义了三种状态:`Qt::Unchecked`(未选中),`Qt::Checked`(选中),以及`Qt::PartiallyChecked`(三态,通常用于表示不确定状态)。例如,如果你想将一个`CheckBox`...

    Exceptions in Java and Eiffel:Two Extremes in Exception Design and Application

    Java中的异常分为两大类:检查异常(checked exceptions)和运行时异常(runtime exceptions)。检查异常是指编译器强制要求程序员必须处理的异常类型,通常用于表示程序中可能出现的正常但无法预料的情况;而运行时...

    Essential C

    - **Switch Statement**: Allows for multiple conditions to be checked against a single variable. - **While Loop**: Executes a block of code repeatedly while a condition is true. - **For Loop**: Similar...

    IOS5 Programming Cookbook

    Based on the provided information from "iOS 5 Programming Cookbook" by Vandad Nahavandipoor, we can derive a comprehensive set of knowledge points related to iOS development using Objective-C....

    C++ and the Perils of Double Checked Locking.zip

    《C++ and the Perils of Double Checked Locking》是一篇探讨C++编程中双重检查锁定(Double-Checked Locking)模式潜在问题的文献。在多线程编程中,双重检查锁定是一种常见的优化策略,旨在减少对同步原语的依赖...

    TMS Pack for FireMonkey2.3.0.1

    Built-in support for LiveBindings in TTMSFMXTableView and TTMSFMXTileList, allows to bind any item element to data Includes various demos and an extensive PDF developers guide Includes various helper ...

    Professional C# 3rd Edition

    Chapter 11: Errors and Exceptions 277 Looking into Errors and Exception Handling 277 Exception Classes 278 Catching Exceptions 280 User-Defined Exception Classes 290 Summary 297 Part II: The .NET ...

    移除旧版intraweb工具,支持RDS 2009~XE6

    Search and list files but DON'T delete them: If checked, will list all IntraWeb files found on Delphi installation path. No files are deleted. Probably is a good idea to check that before actually ...

    C++ and the Perils of Double-Checked Locking

    在介绍双检锁模式(Double-Checked Locking Pattern,DCLP)的C++实现中,Scott Meyers和Andrei Alexandrescu在其2004年的文章中指出,传统的单例模式实现并不具备线程安全性。单例模式是设计模式中经常被提及的一种...

    SystemVerilog Assertions - Design Tricks and SVA Bind Files_pres

    They are essential for detecting violations of design properties and are often used in formal verification. They allow engineers to monitor the design over time and ensure that it behaves as expected...

    eac3to V3.17

    * errors in TS/m2ts files are now reported (with runtime) and ignored * damaged first max 5MB and max 5% of a TS/m2ts file are automatically skipped * video/audio tracks which can't be parsed, are now...

    QTableWidget中嵌入多个复选框

    QTableWidgetItem *checkBoxItem = new QTableWidgetItem(QTableWidgetItem::Type); ``` 2. **设置复选框**:将创建的`QTableWidgetItem`插入到`QTableWidget`中,指定行和列位置。然后,可以使用`setCheckState()`...

    QT的QTreeWidget有checkbox时轻松选中

    item->setCheckState(checkboxColumn, item->checkState(checkboxColumn) == Qt::Checked ? Qt::Unchecked : Qt::Checked); } else { // 如果点击的是其他列,也切换复选框状态 for (int i = 0; i < item->...

Global site tag (gtag.js) - Google Analytics