auto commit
This commit is contained in:
@ -484,7 +484,7 @@ System.out.println(InterfaceExample.x);
|
||||
使用抽象类:
|
||||
|
||||
- 需要在几个相关的类中共享代码。
|
||||
- 需要能控制继承来的方法和域的访问权限,而不是都为 public。
|
||||
- 需要能控制继承来的成员的访问权限,而不是都为 public。
|
||||
- 需要继承非静态(non-static)和非常量(non-final)字段。
|
||||
|
||||
使用接口:
|
||||
@ -763,10 +763,10 @@ try {
|
||||
```
|
||||
|
||||
```html
|
||||
java.lang.CloneNotSupportedException: CloneTest
|
||||
java.lang.CloneNotSupportedException: CloneExample
|
||||
```
|
||||
|
||||
以上抛出了 CloneNotSupportedException,这是因为 CloneTest 没有实现 Cloneable 接口。
|
||||
以上抛出了 CloneNotSupportedException,这是因为 CloneExample 没有实现 Cloneable 接口。
|
||||
|
||||
```java
|
||||
public class CloneExample implements Cloneable {
|
||||
@ -1112,7 +1112,7 @@ Reflection is powerful, but should not be used indiscriminately. If it is possib
|
||||
Throwable 可以用来表示任何可以作为异常抛出的类,分为两种: **Error** 和 **Exception**。其中 Error 用来表示 JVM 无法处理的错误,Exception 分为两种:
|
||||
|
||||
- **受检异常** :需要用 try...catch... 语句捕获并进行处理,并且可以从异常中恢复;
|
||||
- **非受检异常** :是程序运行时错误,例如除 0 会引发 Arithmetic Exception,此时程序奔溃并且无法恢复。
|
||||
- **非受检异常** :是程序运行时错误,例如除 0 会引发 Arithmetic Exception,此时程序崩溃并且无法恢复。
|
||||
|
||||
<div align="center"> <img src="../pics//PPjwP.png" width="600"/> </div><br>
|
||||
|
||||
|
Reference in New Issue
Block a user