当前位置:网站首页>Simple understanding of generics

Simple understanding of generics

2022-07-04 10:58:00 Black demon fairy moon

Generic

1. Definition of generics

java Generics in are only valid at compile time , Invalid runtime , Also known as erasability of generics

2. Application of generics

1. Generics are used in interfaces
Interface The interface name < Generic >
2. Generics are used in classes
class Class name < Generic >
3. Generics are used in methods
Modifier < Generic > return type Method name ( parameter list )

3. Generic wildcards

<?> Unbounded wildcards <? extends> The upper bound qualifies wildcards <? super> The lower bound qualifies wildcards
原网站

版权声明
本文为[Black demon fairy moon]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202141412499906.html