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- ...
随机推荐
- Others-常用数学符号大全
常用数学符号读法大全 大写 小写 英文注音 国际音标注音 中文注音 Α α alpha alfa 阿耳法 Β β beta beta 贝塔 Γ γ gamma gamma 伽马 Δ δ deta de ...
- 使用dig或nslookup指定dns服务器查询域名解析
一般来说linux下查询域名解析有两种选择,nslookup或者dig,而在使用上我觉得dig更加方便顺手.如果是在linux下的话,只要装上dnsutils这个包就可以使用dig命令, 安装bind ...
- Android 操作UI线程的一些方法
我们经常会在后台线程中去做一些耗时的操作,比如去网络取数据.但是当数据取回来,需要显示到页面上的时候,会遇到一些小麻烦,因为我们都知道,android的UI页面是不允许在其他线程直接操作的.下面总结4 ...
- Ajax 学习 第二篇
XMLHttpRequest发送请求 open(method,url,async) 解释 method:do/post,不区分大小写 URL:相对地址 文档地址 async:默认为TRUE 即异步 F ...
- hadoop-1(单机模式配置)
下一次的目标是: 把Hadoop的伪分布式配置出来 1:ssh免密码登陆第一步 2:安装java环境 3:安装hadoop2
- [图解tensorflow源码] 入门准备工作附常用的矩阵计算工具[转]
[图解tensorflow源码] 入门准备工作 附常用的矩阵计算工具[转] Link: https://www.cnblogs.com/yao62995/p/5773142.html tensorf ...
- ArcGIS案例学习笔记-CAD数据自动拓扑检查
ArcGIS案例学习笔记-CAD数据自动拓扑检查 联系方式:谢老师,135-4855-4328,xiexiaokui#qq.com 功能:针对CAD数据,自动进行拓扑检查 优点:类别:地理建模项目实例 ...
- 2018面向对象程序设计(Java)第9周学习指导及要求
2018面向对象程序设计(Java)第9周学习指导及要求(2018.10.25-2018.10.28) 学习目标 1.掌握java异常处理技术: 2.了解断言的用法: 3.了解日志的用途: 4.掌 ...
- Mysql 表约束 非空、唯一、主键、自增长、默认、外键约束(基础6)
非空(not null).唯一(unique key).主键(primary key).自增长(auto_increment).默认约束(default) 准备基础环境: mysql> crea ...
- :after伪类+content经典应用举例
:after伪类+content 清除浮动的影响 .box{padding:10px; background:gray;} .l{float:left;} <div class="bo ...