Skip to content

Commit

Permalink
✏更新 Java 泛型
Browse files Browse the repository at this point in the history
  • Loading branch information
0xcaffebabe committed Sep 16, 2020
1 parent 9e2b38b commit 3643aac
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions 编程语言/JAVA/高级/泛型.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@
- 泛型接口
- 泛型方法

关于泛型的几点:

1. 尖括号里的每个元素都代表一种未知类型
2. 尖括号只能出现在类名之后或者方法返回值之前

使用泛型的好处:

1. 类型安全 避免粗心导致的类转换异常
2. 提升代码可读性 编码阶段即可知道对象类型
3. 提升了代码的复用率

## 泛型类

```java
Expand Down

0 comments on commit 3643aac

Please sign in to comment.