new commit
This commit is contained in:
33
泛型.md
Normal file
33
泛型.md
Normal file
@@ -0,0 +1,33 @@
|
||||
# 泛型
|
||||
|
||||
介绍:
|
||||
|
||||
JDK5版本后引入,用处为编译阶段约束数据类型,并例行检查。
|
||||
|
||||
好处:
|
||||
|
||||
统一了数据类型,将运行期的错误提到了编译期。
|
||||
|
||||
注意:
|
||||
|
||||
泛型只能用引用数据类型
|
||||
|
||||
## 泛型类
|
||||
|
||||
<img src="https://gitee.com/icecat2233/picture/raw/master/20250428164803021.png" alt="image-20250428164753200" style="zoom:80%;" />
|
||||
|
||||
## 泛型方法
|
||||
|
||||
<img src="https://gitee.com/icecat2233/picture/raw/master/20250428164850644.png" alt="image-20250428164848721" style="zoom:67%;" />
|
||||
|
||||
## 泛型接口
|
||||
|
||||
<img src="https://gitee.com/icecat2233/picture/raw/master/20250428165135118.png" alt="image-20250428165133488" style="zoom: 67%;" />
|
||||
|
||||
## 泛型通配符
|
||||
|
||||
<img src="https://gitee.com/icecat2233/picture/raw/master/20250428165220144.png" alt="image-20250428165218560" style="zoom:67%;" />
|
||||
|
||||
## 总结
|
||||
|
||||
<img src="https://gitee.com/icecat2233/picture/raw/master/20250428165312329.png" alt="image-20250428165310376" style="zoom: 60%;" />
|
||||
Reference in New Issue
Block a user