Exceptions
【定义】
error: external, like out of memory
exception: internal, like file not found
父类都是throwable 逻辑有错是runtimeerror

【是否check】
unchecked types: error, run time exception
how to solve checked: catch, specify
【处理方法】
Scanner input = new Scanner(new File(filename)); 必须要有
file not found exception
【exception处理情景】

顺序:从特殊到一般,最特殊的是3,先处理3


【Custom exceptions 自定义异常】
可能会抛出或捕获运行时异常,但编译器不会检查它们
从try-block抛出异常时,它可以被任何catch块捕获和处理
从catch块中抛出异常时,它不能被同一级别的其他catch块捕获。 在catch-block中创建一个嵌套的try-catch块,以在内部catch块中处理它。
自定义的Exception要加new
Exceptions的更多相关文章
- "NHibernate.Exceptions.GenericADOException: could not load an entity" 解决方案
今天,测试一个项目的时候,抛出了这个莫名其妙的异常,然后就开始了一天的调试之旅... 花了很长时间,没有从代码找出任何问题... 那么到底哪里出问题呢? 根据下面那段长长的错误日志: -- ::, ...
- 2000条你应知的WPF小姿势 基础篇<34-39 Unhandled Exceptions和Resource>
在正文开始之前需要介绍一个人:Sean Sexton. 来自明尼苏达双城的软件工程师.最为出色的是他维护了两个博客:2,000Things You Should Know About C# 和 2,0 ...
- com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'dd' in 'where clause'
今天在使用mysql数据库查找数据的时候报错,错误信息如下: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown co ...
- MIT 6.828 JOS学习笔记18. Lab 3.2 Part B: Page Faults, Breakpoints Exceptions, and System Calls
现在你的操作系统内核已经具备一定的异常处理能力了,在这部分实验中,我们将会进一步完善它,使它能够处理不同类型的中断/异常. Handling Page Fault 缺页中断是一个非常重要的中断,因为我 ...
- Solve VS2010 Error "Exceptions has been thrown by the target of an invocation"
Sometimes when you open a VS2010 project, an error window will pop up with the error message "E ...
- MyBatis-Exception:org.apache.ibatis.exceptions.PersistenceException
错误信息如下: HTTP Status 500 - org.mybatis.spring.MyBatisSystemException: nested exception is org.apache. ...
- App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file
ios进行http请求,会出现这个问题: App Transport Security has blocked a cleartext HTTP (http://) resource load sin ...
- 添加 All Exceptions 断点后, 每次运行都会在 main.m 中断的一种解决方法
在本人项目添加导入和使用新的字体过程中,遇到一个很奇怪的问题: 项目开启了全局断点,但是每次启动都会运行在mian.m中断,点击下一步程序继续正常运行. 不知道是什么原因,于是google百度寻找答案 ...
- python基于Django框架编译报错“django.core.exceptions.ImproperlyConfigured”的解决办法?
下面是我具体遇到的问题和解决方法: 错误详细信息: django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_IND ...
- Rethrowing exceptions and preserving the full call stack trace
refer:http://weblogs.asp.net/fmarguerie/archive/2008/01/02/rethrowing-exceptions-and-preserving-the- ...
随机推荐
- 爬虫--requests模块高级(代理和cookie操作)
代理和cookie操作 一.基于requests模块的cookie操作 引言:有些时候,我们在使用爬虫程序去爬取一些用户相关信息的数据(爬取张三“人人网”个人主页数据)时,如果使用之前requests ...
- 子类中的成员函数覆盖父类(name hiding)
只要子类中出现了和父类中同名的函数,父类中的所有这个名字的函数,就被屏蔽了. 静态函数成员也是如此?经过代码验证,确实如此. #include <iostream> using names ...
- CSS COLOR
CSS COLOR Color Review We've completed our extensive tour of the colors in CSS! Let's review the key ...
- UGUI 判断元素进入舞台
void LateUpdate () { if(!_isLoaded){ RectTransform rectt=this.GetComponent<RectTransform>(); f ...
- Java设置运行时环境参数
一.代码中,如下: System.setProperty("java.util.concurrent.ForkJoinPool.common.parallelism", " ...
- DO and DOES Reduction
DO and DOES Reduction Share Tweet Share Tagged With: DO and DOES Reductions ‘Do’ and ‘does’ can be r ...
- 安装vue CLI后, 出现安装权限问题
问题:安装vue CLI后,出现:npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/usr/l ...
- git-03 建立分支
git branch han git checkout git push origin han
- Jsp基本语法 第二节
关于JSP的声明 即在JSP页面定义方法或者变量: <%!Java代码%> 在JSP页面中执行的表达式:<%=表达式%> 这个里尤其注意不能以:结束 JSP页面生命周期 ...
- js字符串和控制语句
1.js的字符串 * 字符串* 字符串是js数据类型中的一种*字符串拼接:+,加号有两层含义* 1.数学中的加法运算;* 2.字符串连接,当加号的任意一边是一个字符串,那就是字符串连接的意思; < ...