读书人

Java 基本类学习札记

发布时间: 2012-09-10 11:02:33 作者: rapoo

Java 基本类学习笔记

1. 异常

定义:异常就是程序执行时破环正常流程指令

异常有三种:
a. 检查时异常(checked exception)
b. error
c. 运行时异常(runtime exception or unchecked exceptions)

JavaSE 7以后,一个异常使用“|”能处理块能处理多个异常,eg:

catch (IOException|SQLException ex) {     logger.log(ex);     throw ex; } 

??? //当一个异常块处理多个异常时,参数ex是隐式的final类型。

Java不需要catch或定义unchecked exceptions

try{}catch(){}语句,如果有finally{}块的话,可以需要catch块

异常处理建议:If a client can reasonably be expected to recover from an exception, make it a checked exception. If a client cannot do anything to recover from the exception, make it an unchecked exception

2. 基本I/O


3. 并发



[b]4. 环境平台


[/b]

5. 常用语句

?

读书人网 >编程

热点推荐